public JsonResult SaveAll(String[] hfoperatorcode, String[] md, String[] sd, String[] r, String[] charge, Guid rechargeslabid2)
        {
            GlobalVarible.Clear();
            try
            {
                if (hfoperatorcode == null || md == null || sd == null || r == null || charge == null)
                {
                    GlobalVarible.AddError("please add pricing details!");
                    return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet));
                }
                if (hfoperatorcode.Length > 0)
                {
                    bool outval = new BAL.SlabCommission().DeleteByID(rechargeslabid2);

                    List <ENT.SlabCommission> priceList = new List <ENT.SlabCommission>();
                    for (int sc = 0; sc < hfoperatorcode.Length; sc++)
                    {
                        if ((md[sc].ToString() != "0") || (sd[sc].ToString() != "0") || (r[sc].ToString() != "0") || (charge[sc].ToString() != "0"))
                        {
                            ENT.SlabCommission pdmodel = new Web.Framework.Entity.SlabCommission();
                            pdmodel.rechargeslabid  = Guid.NewGuid();
                            pdmodel.CreatedDateTime = DateTime.Now;
                            pdmodel.CreatedBy       = Guid.Parse(User.Identity.GetUserId());
                            pdmodel.slabid          = rechargeslabid2;
                            pdmodel.operatorcode    = int.Parse(hfoperatorcode[sc]);
                            pdmodel.md     = decimal.Parse(md[sc]);
                            pdmodel.sd     = decimal.Parse(sd[sc]);
                            pdmodel.r      = decimal.Parse(r[sc]);
                            pdmodel.charge = decimal.Parse(charge[sc]);
                            priceList.Add(pdmodel);
                        }
                    }
                    using (BAL.SlabCommission objPrice = new BAL.SlabCommission())
                    {
                        int Val = objPrice.BulkInsert(priceList);
                        if (Val > 0)
                        {
                            GlobalVarible.AddMessage("Record Save Successfully.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
            }
            MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML();
            return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                }
                objDAL    = null;
                clsDAL    = null;
                Entity    = null;
                lstEntity = null;
                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }