Ejemplo n.º 1
0
        public ActionResult Edit(Models.CostCentreModel data)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    long cid = 0;
                    long.TryParse(User.Identity.GetUserId(), out cid);
                    CLayer.CostCentre empcost = new CLayer.CostCentre();
                    {
                        empcost.CostCentreCode = data.CostCentreCode;
                        empcost.CostcentreName = data.CostCentreName;
                        empcost.B2B_ID         = cid;
                    };
                    BLayer.CostCentre.Save(empcost);

                    ViewBag.Saved = true;
                }
                else
                {
                    ViewBag.Saved = false;
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect("~/ErrorPage"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            try
            {
                ViewBag.Saved = false;
                Models.CostCentreModel data = new Models.CostCentreModel()
                {
                    CostCentreCode = 0
                };

                CLayer.CostCentre B2BCostCentre = BLayer.CostCentre.Get(id);

                if (B2BCostCentre != null)
                {
                    data = new Models.CostCentreModel()
                    {
                        CostCentreCode = B2BCostCentre.CostCentreCode,
                        CostCentreName = B2BCostCentre.CostcentreName,
                        B2B_ID         = B2BCostCentre.B2B_ID
                    }
                }
                ;
                return(PartialView("~/Views/CostCentre/_Edit.cshtml", data));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect("~/ErrorPage"));
            }
        }
Ejemplo n.º 3
0
        public int Save(CLayer.CostCentre taxTi)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pCostCentreCode", DataPlug.DataType._Varchar, taxTi.CostCentreCode));
            param.Add(Connection.GetParameter("pCostCentreName", DataPlug.DataType._Varchar, taxTi.CostcentreName));
            param.Add(Connection.GetParameter("pB2BID", DataPlug.DataType._BigInt, taxTi.B2B_ID));
            int result = Connection.ExecuteQuery("SP_CostCentre_Save", param);

            return(result);
        }
Ejemplo n.º 4
0
        public CLayer.CostCentre GetById(int CostCentreCode)
        {
            CLayer.CostCentre         taxTi = null;
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pCostCentreCode", DataPlug.DataType._BigInt, CostCentreCode));
            DataTable dt = Connection.GetTable("SP_CostcentreById_Get", param);

            if (dt.Rows.Count > 0)
            {
                taxTi = new CLayer.CostCentre();
                taxTi.CostCentreCode = Connection.ToLong(dt.Rows[0]["CostCentreCode"]);
                taxTi.CostcentreName = Connection.ToString(dt.Rows[0]["CostCentreName"]);
                taxTi.B2B_ID         = Connection.ToLong(dt.Rows[0]["B2B_ID"]);
            }
            return(taxTi);
        }
Ejemplo n.º 5
0
 public static int Save(CLayer.CostCentre t)
 {
     DataLayer.CostCentre taxtitsave = new DataLayer.CostCentre();
     //     t.Validate();
     return(taxtitsave.Save(t));
 }