Beispiel #1
0
        public ActionResult Edit(FormCollection frm, int?id)
        {
            A_Depreciation updateDepre = new A_Depreciation();

            updateDepre.DepreciationName = frm["DepreciationName"];
            updateDepre.DepreciationRate = Convert.ToDecimal(frm["DepreciationRate"]);
            updateDepre.Description      = frm["Description"];

            updateDepre.LastUpdatedDate = DateTime.Now;
            updateDepre.LastUpdatedBy   = Convert.ToInt32(Session["UserId"]);

            db.UpdateDepreciation(updateDepre, (int)id);
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public int AddDepreciation(A_Depreciation saveDepre)
        {
            string sql = "insert into A_Depreciation(DepreciationName,DepreciationRate,Description,EnteredBy,EnteredDate,LastUpdatedBy,LastUpdatedDate,DepartmentId," +
                         "IsDeleted,DeletedBy,DeletedDate)" +
                         " values(@DepreciationName,@DepreciationRate,@Description,@EnteredBy,@EnteredDate,0,null,@DepartmentId," +
                         "0,0,null)";

            using (var db = DbHelper.GetDBConnection())
            {
                int id = db.Query <int>(sql, saveDepre).SingleOrDefault();
                db.Close();
                return(id);
            }
        }
Beispiel #3
0
        public ActionResult Create(FormCollection frm)
        {
            A_Depreciation saveDepre = new A_Depreciation();

            saveDepre.DepreciationName = frm["DepreciationName"];
            saveDepre.DepreciationRate = Convert.ToDecimal(frm["DepreciationRate"]);
            saveDepre.Description      = frm["Description"];
            saveDepre.EnteredDate      = DateTime.Now;
            saveDepre.EnteredBy        = Convert.ToInt32(Session["UserId"]);
            saveDepre.DepartmentId     = Convert.ToInt32(frm["DepartmentId"]);

            db.AddDepreciation(saveDepre);
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public bool UpdateDepreciation(A_Depreciation updateDepre, int Id)
        {
            string sql = " Update A_Depreciation set DepreciationName=@DepreciationName, DepreciationRate=@DepreciationRate, Description=@Description," +
                         "LastUpdatedDate=@LastUpdatedDate, LastUpdatedBy=@LastUpdatedBy where IsDeleted=0 and DepreciationId= " + Id;

            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Execute(sql, updateDepre);
                db.Close();
                if (lst > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }