Thursday, November 3, 2016

To get JSON data instead of XML in Web API 2

 // To get JSON data instead of XML, add the following Line in the Resister method of WebApiConfig

            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

Monday, September 19, 2016

How to change password of WIFI router using fing app

                           Change Password Using fing App


Touch/Click on router ip address> scan devices>http>login with admin username and password to get all privileges of  the router.

Saturday, August 22, 2015

How to create a table in sql server DB



How to create a table in sql server DB


CREATE TABLE tblMaster
  (
         RecID        Numeric(6),
         RecTitle     VARCHAR(100),
         RecCode      VARCHAR(10) NOT NULL,
         DataType     Numeric (2) NOT NULL,
         IsDefault    Numeric (1) NOT NULL default(0),
         RecDesc1     Numeric (2),
         RecDesc2     VARCHAR(50),
         RecDesc3     VARCHAR(50),
         ReffRecId    Numeric (6),
    InsertedBy VARCHAR(15)not null,
    InsertedOn DATE not null,
    UpdatedBy  VARCHAR(15) not null,
    UpdatedOn  DATE not null,
    IsActive   CHAR(1) not null DEFAULT('Y'),

         PRIMARY KEY ( RecID ),
         Unique(RecCode),
         FOREIGN KEY(RecID) REFERENCES tblMaster(RecID)
  );

Tuesday, August 18, 2015

STORED PROCEDURE

 

CREATE PROCEDURE [dbo].[proc_Get_StateWiseParticipants] 
 --exec proc_Get_StateWiseParticipants 32   
                  
  @FiscalYrId NUMERIC(5)               
     
  AS   
     
  DECLARE @Sql AS NVARCHAR(1000)    
  DECLARE @Cond AS NVARCHAR(500)    
  DECLARE @ParamDef AS NVARCHAR(300)   
     
  BEGIN    
     
  IF NOT @FiscalYrId=-1   
  SET @Cond=' AND FiscalYrId=@FiscalYrId'     
  ELSE   
  SET @Cond=''   
     
   
     
  SET @Sql='SELECT GradeName,  SUM(Overseas)AS Overseas,SUM(InCountry) AS InCountry,SUM(InHouse)AS InHouse  FROM VW_StateWiseparticipants WHERE 1<>2  '   
     
  SET @Sql=@Sql+@Cond +'  GROUP BY GradeName'   
     
         
SET @ParamDef='@FiscalYrId NUMERIC(5)'        
       
 EXECUTE SP_EXECUTESQL   
 @Sql,   
 @ParamDef,     
 @FiscalYrId  
 END

Saturday, May 24, 2014

How To Find The port No. Of Xampp

To Get The Port No Of Xampp:


Follow the steps:

Xampp>Apache>Conf>httpd.conf>[open with notepad and look for Listen, e.g.'Listen 6060' ]

(e.g. Brouse localhost:6060)


 

Tuesday, February 11, 2014

How To Create Dynamic Dropdownlist in MVC 5 EF 6

*** Just Follow the Bold Lines...


Table:

create table tblInsPlans
(
    InsID        Numeric(11),
    InsDueDate     Datetime,
    InsSeq         Numeric(3),
    InsAmt         Numeric(11,2),
    PaidAmt        Numeric(11,2),
    HeadID         Numeric(3),--FK
    Remarks     Varchar(100),
    InsertedBy     VARCHAR(15) null,
    InsertedOn     DATETime  null,
    UpdatedBy      VARCHAR(15) null,
    UpdatedOn      DATETime  null,
    IsActive       bit not null DEFAULT(0),
    IsDeleted     bit not null DEFAULT(0),

    primary    key(InsID),
    FOREIGN KEY(HeadID) REFERENCES tblColHeads(HeadID)
);

 

Model:

 public class tblInsPlan
    {

        [Required, Key, DatabaseGenerated(DatabaseGeneratedOption.None)]

        [DisplayName("Install ID")]
        public decimal InsID { get; set; }
         [DisplayName("Install Due Date")]
        public DateTime? InsDueDate { get; set; }
         [DisplayName("Install Sequence")]
         public decimal InsSeq { get; set; }
         [DisplayName("Install Amount")]
         public decimal InsAmt { get; set; }
         [DisplayName("Paid Amount")]
         public decimal PaidAmt { get; set; }
         [DisplayName("Head ID")]
         public decimal HeadID { get; set; }
        [DisplayName("Remarks")]
         public decimal Remarks { get; set; }
        [DisplayName("Inserted By")]
        public string InsertedBy { get; set; }
        [DisplayName("Inserted On")]
        public DateTime? InsertedOn { get; set; }
        [DisplayName("Updated By")]
        public string UpdatedBy { get; set; }
        [DisplayName("Updated On")]
        public DateTime? UpdatedOn { get; set; }
        [DisplayName("Is Active")]
        public bool IsActive { get; set; }
        [DisplayName("Is Deleted")]
        public bool IsDeleted { get; set; }

        public virtual tblColHead tblColHead { get; set; }

    }

Controller:

 public class InsPlanController : Controller
    {
        private BLRSDBEntities db = new BLRSDBEntities();

        // GET: /InsPlan/
        public ActionResult Index()
        {

            var tblinsplans = db.tblInsPlans.Include(t => t.tblColHead);

            return View(tblinsplans.ToList());

        }

        // GET: /InsPlan/Details/5
        public ActionResult Details(decimal id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            tblInsPlan tblinsplan = db.tblInsPlans.Find(id);
            if (tblinsplan == null)
            {
                return HttpNotFound();
            }
            return View(tblinsplan);
        }

        // GET: /InsPlan/Create
        public ActionResult Create()
        {

            ViewBag.HeadID = new SelectList(db.tblColHeads, "HeadID", "Title");

            return View();
        }

        // POST: /InsPlan/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include="InsID,InsDueDate,InsSeq,InsAmt,PaidAmt,HeadID,Remarks,InsertedBy,InsertedOn,UpdatedBy,UpdatedOn,IsActive,IsDeleted")] tblInsPlan tblinsplan)
        {
            if (ModelState.IsValid)
            {
              //  tblinsplan.InsID = Common.GetMaxIDInt("tblInsPlans", "InsID");
             //   tblinsplan.InsertedBy = "Mn";
             //   tblinsplan.InsertedOn = System.DateTime.Now;
                db.tblInsPlans.Add(tblinsplan);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.HeadID = new SelectList(db.tblColHeads, "HeadID", "Title", tblinsplan.HeadID);

            return View(tblinsplan);
        }

        // GET: /InsPlan/Edit/5
        public ActionResult Edit(decimal id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            tblInsPlan tblinsplan = db.tblInsPlans.Find(id);
            if (tblinsplan == null)
            {
                return HttpNotFound();
            }

            ViewBag.HeadID = new SelectList(db.tblColHeads, "HeadID", "Title", tblinsplan.HeadID);

            return View(tblinsplan);

        }

        // POST: /InsPlan/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include="InsID,InsDueDate,InsSeq,InsAmt,PaidAmt,HeadID,Remarks,InsertedBy,InsertedOn,UpdatedBy,UpdatedOn,IsActive,IsDeleted")] tblInsPlan tblinsplan)
        {
            if (ModelState.IsValid)
            {
            //    tblinsplan.UpdatedBy = "Mamun";
             //   tblinsplan.UpdatedOn = System.DateTime.Now;
                db.Entry(tblinsplan).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.HeadID = new SelectList(db.tblColHeads, "HeadID", "Title", tblinsplan.HeadID);

            return View(tblinsplan);
        }

        // GET: /InsPlan/Delete/5
        public ActionResult Delete(decimal id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            tblInsPlan tblinsplan = db.tblInsPlans.Find(id);
            if (tblinsplan == null)
            {
                return HttpNotFound();
            }
            return View(tblinsplan);
        }

        // POST: /InsPlan/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(decimal id)
        {
            tblInsPlan tblinsplan = db.tblInsPlans.Find(id);
            db.tblInsPlans.Remove(tblinsplan);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }

    }