コード例 #1
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter = "")
        {
            var db       = new PolicyAllowance_DAL();
            int total    = 0;
            var result   = db.PolicyAllowance_GetList(pageIndex, pageSize, filter, out total);
            var lstTotal = new TableColumnsTotalModel();

            lstTotal.Total1 = "15";
            lstTotal.Total2 = "25";
            lstTotal.Total3 = "35";
            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = lstTotal
            })));
        }
コード例 #2
0
        public ActionResult Policy_Save(Policy data, PolicyAllowance [] List, int [] RemoveListPolicyAllowance)
        {
            //return View();
            var db       = new Policy_DAL();
            var db1      = new PolicyAllowance_DAL();
            int PolicyID = 0;

            data.CreatedOn = Global.CurrentUser.UserID;
            #region
            var result = db.Policy_Save(data);
            if (List != null)
            {
                for (int i = 0; i < List.Length; i++)
                {
                    if (result.Message != "0")
                    {
                        PolicyID = Convert.ToInt32(result.Message);
                        var AutoID              = List[i].AutoID;
                        var AllowanceID         = List[i].AllowanceID;
                        var savePolicyAllowance = db1.PolicyAllowance_Save(AutoID, PolicyID, AllowanceID);
                    }
                    else
                    {
                        PolicyID = data.PolicyID;
                        var AutoID              = List[i].AutoID;
                        var AllowanceID         = List[i].AllowanceID;
                        var savePolicyAllowance = db1.PolicyAllowance_Save(AutoID, PolicyID, AllowanceID);
                    }
                }
            }

            if (RemoveListPolicyAllowance != null)
            {
                for (int i = 0; i < RemoveListPolicyAllowance.Length; i++)
                {
                    var x = RemoveListPolicyAllowance[i];
                    var DeletePolicyAllowance = db1.PolicyAllowance_Delete(x);
                }
            }
            if (data.ListKPI != null && data.ListKPI.Length > 0)
            {
                data.KPI = "";
                for (int i = 0; i < data.ListKPI.Length; i++)
                {
                    if (data.KPI != "")
                    {
                        data.KPI += "," + data.ListKPI[i];
                    }
                    else
                    {
                        data.KPI += data.ListKPI[i];
                    }
                }
                if (result.Message != "0")
                {
                    PolicyID = Convert.ToInt32(result.Message);
                    var savePolicyKpi = db.PolicyKpi_Save(PolicyID, data.KPI);
                }
                else
                {
                    var savePolicyKpi = db.PolicyKpi_Save(data.PolicyID, data.KPI);
                }
            }
            #endregion

            if (result.IsSuccess == true)
            {
                result.Message = AppRes.MS_Update_success;
            }
            else
            {
                result.Message = AppRes.MS_Update_error;
            }
            return(Content(JsonConvert.SerializeObject(new
            {
                result
            })));
        }