示例#1
0
        public Window_Opening_stock()
        {
            InitializeComponent();
            _ItemViewModel   = new ItemViewModel();
            this.DataContext = _ItemViewModel;


            var GoDown  = App.Current.Properties["GoDownList"] as List <AutoGodownModel>;
            var BussLoc = App.Current.Properties["BussLocList"] as List <AutoBussinessModel>;

            foreach (var item in BussLoc)
            {
                BussLocation.AddItem(new AutoBussinessModel
                {
                    DisplayId   = item.DisplayId,
                    DisplayName = item.DisplayName
                });
            }

            foreach (var item in GoDown)
            {
                Godown.AddItem(new AutoGodownModel
                {
                    DisplayId   = item.DisplayId,
                    DisplayName = item.DisplayName
                });
            }

            BussRef = BussLocation;



            //Godown.Text = "";
            GodownRef = Godown;
        }
示例#2
0
        public Godown Post([FromBody] Godown objGodown)
        {
            SqlCommand     command;
            SqlDataAdapter adapter = new SqlDataAdapter();
            string         connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlConnection  conn    = new SqlConnection(connStr);

            conn.Open();

            string sql = "INSERT INTO [dbo].[godown] ([code],[description],[address],[isdefault],[isactive]) VALUES(" + "'" + objGodown.Code + "','" + objGodown.Description + "','" + objGodown.Address + "','" + Convert.ToString(objGodown.IsDefault) + "','" + Convert.ToString(objGodown.IsActive) + "')";

            command = new SqlCommand(sql, conn);
            adapter.InsertCommand = new SqlCommand(sql, conn);
            adapter.InsertCommand.ExecuteNonQuery();

            sql = "select max(id) from [dbo].[godown]";
            SqlCommand cmd = new SqlCommand(sql, conn);


            int id = (int)cmd.ExecuteScalar();

            command.Dispose();

            conn.Close();

            objGodown.Id = id;

            return(objGodown);
        }
示例#3
0
        public Godown Update([FromBody] Godown objGodown)
        {
            SqlCommand     command;
            SqlDataAdapter adapter = new SqlDataAdapter();
            string         connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlConnection  conn    = new SqlConnection(connStr);

            conn.Open();
            string sql = "UPDATE [dbo].[godown]" +
                         " SET [code] = '" + objGodown.Code + "'" +
                         ",[description] = '" + objGodown.Description + "'" +
                         ",[address] = '" + objGodown.Address + "'" +
                         ",[isdefault] = '" + objGodown.IsDefault + "'" +
                         ",[isactive] = '" + objGodown.IsActive + "'" +
                         " WHERE id=" + objGodown.Id + "";

            //string sql = "INSERT INTO [dbo].[racks] ([code],[description],[capacity],[isdefault],[isactive]) VALUES(" + "'" + objRack.Code + "','" + objRack.Description + "'," + objRack.Capacity + ",'" + Convert.ToString(objRack.IsDefault) + "','" + Convert.ToString(objRack.IsActive) + "')";
            command = new SqlCommand(sql, conn);
            adapter.UpdateCommand = new SqlCommand(sql, conn);
            adapter.UpdateCommand.ExecuteNonQuery();

            command.Dispose();

            conn.Close();

            return(objGodown);
        }
示例#4
0
 public void ShowDlg(Godown oGodown, bool IsNew)
 {
     _IsNew  = IsNew;
     _Godown = oGodown;
     RefreshValue();
     this.ShowDialog();
 }
示例#5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                using (DEWSRMEntities db = new DEWSRMEntities())
                {
                    int[]       selRows    = ((GridView)grdGodowns.MainView).GetSelectedRows();
                    DataRowView oCategoryD = (DataRowView)(((GridView)grdGodowns.MainView).GetRow(selRows[0]));

                    int    nID     = Convert.ToInt32(oCategoryD["ID"]);
                    Godown oGodown = db.Godowns.FirstOrDefault(p => p.GodownID == nID);

                    if (oGodown == null)
                    {
                        MessageBox.Show("select an item to delete", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (MessageBox.Show("Do you want to delete the selected item?", "Delete Setup", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        db.Godowns.Attach(oGodown);
                        db.Godowns.Remove(oGodown);
                        db.SaveChanges();
                        MessageBox.Show("Data Deleted Successfully.", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        RefreshList();
                    }
                    ;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                using (DEWSRMEntities db = new DEWSRMEntities())
                {
                    int[]       selRows    = ((GridView)grdGodowns.MainView).GetSelectedRows();
                    DataRowView oCategoryD = (DataRowView)(((GridView)grdGodowns.MainView).GetRow(selRows[0]));

                    int    nID     = Convert.ToInt32(oCategoryD["ID"]);
                    Godown oGodown = db.Godowns.FirstOrDefault(p => p.GodownID == nID);


                    if (oGodown == null)
                    {
                        MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    fGodown frm = new fGodown();
                    frm.ItemChanged = RefreshList;
                    frm.ShowDlg(oGodown, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#7
0
        public void Delete(int id)
        {
            Godown pt = Find(id);

            pt.ObjectState = ObjectState.Deleted;
            _unitOfWork.Repository <Godown>().Delete(pt);
        }
示例#8
0
        public Godown Create(Godown pt)
        {
            pt.ObjectState = ObjectState.Added;
            _unitOfWork.Repository <Godown>().Add(pt);


            return(pt);
        }
示例#9
0
        // GET: /GodownMaster/Create

        public ActionResult Create()
        {
            Godown vm = new Godown();

            vm.SiteId   = (int)System.Web.HttpContext.Current.Session["SiteId"];
            vm.IsActive = true;
            return(View("Create", vm));
        }
示例#10
0
        public ActionResult DeleteConfirmed(ReasonViewModel vm)
        {
            if (ModelState.IsValid)
            {
                //Commit the DB
                try
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    Godown temp      = _GodownService.Find(vm.id);
                    int    DocTypeId = (int)temp.DocTypeId;

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = Mapper.Map <Godown>(temp),
                    });

                    IEnumerable <BinLocation> BinLocationList = _BinLocationService.GetBinLocationListForGodown(vm.id);

                    foreach (BinLocation item in BinLocationList)
                    {
                        _BinLocationService.Delete(item);
                    }

                    XElement Modifications = _modificationCheck.CheckChanges(LogList);

                    _GodownService.Delete(vm.id);



                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = DocTypeId,
                        DocId           = temp.GodownId,
                        ActivityType    = (int)ActivityTypeContants.Deleted,
                        UserRemark      = vm.Reason,
                        DocNo           = temp.GodownName,
                        xEModifications = Modifications,
                        DocDate         = temp.CreatedDate,
                    }));
                }


                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    TempData["CSEXC"] += message;
                    return(PartialView("_Reason", vm));
                }



                return(Json(new { success = true }));
            }
            return(PartialView("_Reason", vm));
        }
示例#11
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            Godown pt = _GodownService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
示例#12
0
        // GET: /JobReceiveHeader/Create

        public ActionResult Create()//DocumentTypeId
        {
            Godown vm = new Godown();

            vm.DocTypeId = Constants.DocumentTypeIdConstants.Godown;
            vm.SiteId    = (int)System.Web.HttpContext.Current.Session["SiteId"];
            vm.IsActive  = true;
            ViewBag.Mode = "Add";
            return(View("Create", vm));
        }
示例#13
0
        // GET: /JobReceiveHeader/Edit/5
        private ActionResult Edit(int id, string IndexType)
        {
            Godown pt = _GodownService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Mode = "Edit";
            return(View("Create", pt));
        }
        public static BaseGodownModel ToBaseGodown(this Godown godown)
        {
            BaseGodownModel _result = new BaseGodownModel();

            _result.Id           = godown.Id;
            _result.GodownName   = godown.GodownName;
            _result.Narration    = godown.Narration;
            _result.CreatedDate  = godown.CreatedDate;
            _result.ModifiedDate = godown.ModifiedDate;
            return(_result);
        }
        // POST: odata/Godowns
        public async Task <IHttpActionResult> Post(Godown godown)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Godowns.Add(godown);
            await db.SaveChangesAsync();

            return(Created(godown));
        }
示例#16
0
        public ActionResult _Create(int Id) //Id ==>GodownId
        {
            BinLocation s = new BinLocation();

            ViewBag.LineMode = "Create";

            Godown Godown = _GodownService.Find(Id);

            ViewBag.DocNo = Godown.GodownName;
            s.GodownId    = Id;
            return(PartialView("_Create", s));
        }
示例#17
0
        //[ValidateAntiForgeryToken]
        public ActionResult DeletePost(BinLocation vm)
        {
            bool BeforeSave = true;

            if (BeforeSave)
            {
                try
                {
                    Godown temp = _GodownService.Find(vm.GodownId);

                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    BinLocation BinLocation = _BinLocationService.Find(vm.BinLocationId);
                    LogList.Add(new LogTypeViewModel
                    {
                        Obj = Mapper.Map <BinLocation>(BinLocation),
                    });

                    LogList.Add(new LogTypeViewModel
                    {
                        Obj = Mapper.Map <BinLocation>(BinLocation),
                    });

                    XElement Modifications = _modificationCheck.CheckChanges(LogList);


                    _BinLocationService.Delete(vm.BinLocationId);

                    _logger.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = (int)temp.DocTypeId,
                        DocId           = temp.GodownId,
                        DocLineId       = BinLocation.BinLocationId,
                        ActivityType    = (int)ActivityTypeContants.Deleted,
                        DocNo           = temp.GodownName,
                        xEModifications = Modifications,
                        DocDate         = temp.CreatedDate,
                    }));
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    TempData["CSEXCL"] += message;
                    ViewBag.LineMode    = "Delete";
                    return(PartialView("_Create", vm));
                }
            }

            return(Json(new { success = true }));
        }
        // DELETE: odata/Godowns(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] short key)
        {
            Godown godown = await db.Godowns.FindAsync(key);

            if (godown == null)
            {
                return(NotFound());
            }

            db.Godowns.Remove(godown);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public static Godown ToGodown(this BaseGodownModel godown)
        {
            Godown _result = new Godown();

            if (godown.Id.HasValue)
            {
                _result.Id = godown.Id.GetValueOrDefault();
            }
            _result.GodownName   = godown.GodownName;
            _result.Narration    = godown.Narration;
            _result.CreatedDate  = godown.CreatedDate;
            _result.ModifiedDate = godown.ModifiedDate;
            return(_result);
        }
示例#20
0
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Godown Godown = db.Godown.Find(id);

            if (Godown == null)
            {
                return(HttpNotFound());
            }
            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
示例#21
0
        public static GodownViewModel Detach(Godown godown)
        {
            GodownViewModel godownviewmodel = new GodownViewModel();

            godownviewmodel.GodownId      = godown.GodownId;
            godownviewmodel.GodownName    = godown.GodownName;
            godownviewmodel.GodownAddress = godown.GodownAddress;
            godownviewmodel.ContactNo     = godown.ContactNo;
            godownviewmodel.ContactPerson = godown.ContactPerson;
            godownviewmodel.CompanyId     = godown.CompanyId;
            godownviewmodel.BranchId      = godown.BranchId;
            godownviewmodel.Status        = godown.Status;
            godownviewmodel.CreatedBy     = godown.CreatedBy;
            godownviewmodel.CreatedOn     = godown.CreatedOn;
            godownviewmodel.UpdatedBy     = godown.UpdatedBy;
            godownviewmodel.UpdatedOn     = godown.UpdatedOn;

            return(godownviewmodel);
        }
示例#22
0
        public IEnumerable <Godown> Get()
        {
            List <Godown> godowns = new List <Godown>();

            string        connStr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlConnection conn    = new SqlConnection(connStr);

            string     sql = "SELECT * from godown";
            SqlCommand cmd = new SqlCommand(sql, conn);

            conn.Open();

            try
            {
                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Godown godown = new Godown();

                        godown.Id          = reader.GetInt32(0);
                        godown.Code        = reader.GetString(1);
                        godown.Description = reader.GetString(2);
                        godown.Address     = reader.GetString(3);
                        godown.IsDefault   = reader.GetBoolean(4);
                        godown.IsActive    = reader.GetBoolean(5);

                        godowns.Add(godown);
                    }
                }

                conn.Close();

                return(godowns);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#23
0
        private ActionResult Remove(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Godown Godown = _GodownService.Find(id);

            if (Godown == null)
            {
                return(HttpNotFound());
            }



            ReasonViewModel rvm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", rvm));
        }
        // PUT: odata/Godowns(5)
        public async Task <IHttpActionResult> Put([FromODataUri] short key, Delta <Godown> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Godown godown = await db.Godowns.FindAsync(key);

            if (godown == null)
            {
                return(NotFound());
            }

            patch.Put(godown);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GodownExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(godown));
        }
示例#25
0
        public ActionResult _Modify(int id)
        {
            BinLocation temp = _BinLocationService.Find(id);


            Godown Godown = _GodownService.Find(temp.GodownId);

            ViewBag.DocNo = Godown.GodownName;
            //Getting Settings

            if (temp == null)
            {
                return(HttpNotFound());
            }


            if ((TimePlanValidation || Continue))
            {
                ViewBag.LineMode = "Edit";
            }


            return(PartialView("_Create", temp));
        }
示例#26
0
        public ActionResult Post(Godown vm)
        {
            Godown pt = vm;

            if (ModelState.IsValid)
            {
                if (vm.GodownId <= 0)
                {
                    pt.IsActive     = true;
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;
                    _GodownService.Create(pt);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", vm));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Godown).DocumentTypeId,
                        DocId        = pt.GodownId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));

                    return(RedirectToAction("Create").Success("Data saved successfully"));
                }

                else
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    Godown temp = _GodownService.Find(pt.GodownId);

                    Godown ExRec = Mapper.Map <Godown>(temp);

                    temp.GodownName   = pt.GodownName;
                    temp.GateId       = pt.GateId;
                    temp.IsActive     = pt.IsActive;
                    temp.ModifiedDate = DateTime.Now;
                    temp.ModifiedBy   = User.Identity.Name;
                    temp.ObjectState  = Model.ObjectState.Modified;
                    _GodownService.Update(temp);

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = temp,
                    });

                    XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", pt));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Godown).DocumentTypeId,
                        DocId           = temp.GodownId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }
示例#27
0
 public void Update(Godown godown)
 {
     godownRepository.Update(godown);
 }
示例#28
0
 public void Add(Godown godown)
 {
     godownRepository.Add(godown);
 }
示例#29
0
        public Godown GetGodownById(int id)
        {
            Godown Godown = godownRepository.GetById(id);

            return(Godown);
        }
示例#30
0
        //[ValidateAntiForgeryToken]
        public ActionResult _CreatePost(BinLocation svm)
        {
            bool   BeforeSave = true;
            Godown temp       = _GodownService.Find(svm.GodownId);


            if (_BinLocationService.IsDuplicateBinLocationName(svm.GodownId, svm.BinLocationCode, svm.BinLocationId))
            {
                ModelState.AddModelError("BinLocationId", "Chak Code is already entered in Property.");
            }

            if (_BinLocationService.IsDuplicateBinLocationName(svm.GodownId, svm.BinLocationName, svm.BinLocationId))
            {
                ModelState.AddModelError("BinLocationId", "Chak Name is already entered in Property.");
            }

            if (svm.BinLocationId <= 0)
            {
                ViewBag.LineMode = "Create";
            }
            else
            {
                ViewBag.LineMode = "Edit";
            }

            if (ModelState.IsValid && BeforeSave)
            {
                if (svm.BinLocationId <= 0)
                {
                    try
                    {
                        svm.IsActive     = true;
                        svm.CreatedDate  = DateTime.Now;
                        svm.ModifiedDate = DateTime.Now;
                        svm.CreatedBy    = User.Identity.Name;
                        svm.ModifiedBy   = User.Identity.Name;
                        svm.ObjectState  = Model.ObjectState.Added;
                        _BinLocationService.Create(svm);

                        _logger.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                        {
                            DocTypeId    = (int)temp.DocTypeId,
                            DocId        = temp.GodownId,
                            DocLineId    = svm.BinLocationId,
                            ActivityType = (int)ActivityTypeContants.Added,
                            DocNo        = temp.GodownName,
                            DocDate      = temp.CreatedDate,
                        }));
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        TempData["CSEXCL"] += message;
                        return(PartialView("_Create", svm));
                    }

                    return(RedirectToAction("_Create", new { id = svm.GodownId }));
                }


                else
                {
                    try
                    {
                        BinLocation binlocation = _BinLocationService.Find(svm.BinLocationId);

                        List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                        BinLocation ExTempLine = new BinLocation();
                        ExTempLine = Mapper.Map <BinLocation>(binlocation);

                        binlocation.BinLocationCode = svm.BinLocationCode;
                        binlocation.BinLocationName = svm.BinLocationName;
                        binlocation.IsActive        = svm.IsActive;
                        binlocation.ModifiedDate    = DateTime.Now;
                        binlocation.ModifiedBy      = User.Identity.Name;
                        binlocation.ObjectState     = Model.ObjectState.Modified;
                        _BinLocationService.Update(binlocation);

                        LogList.Add(new LogTypeViewModel
                        {
                            ExObj = ExTempLine,
                            Obj   = binlocation
                        });


                        XElement Modifications = _modificationCheck.CheckChanges(LogList);


                        _logger.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                        {
                            DocTypeId       = (int)temp.DocTypeId,
                            DocId           = temp.GodownId,
                            DocLineId       = binlocation.BinLocationId,
                            ActivityType    = (int)ActivityTypeContants.Modified,
                            DocNo           = temp.GodownName,
                            xEModifications = Modifications,
                            DocDate         = temp.CreatedDate,
                        }));
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        TempData["CSEXCL"] += message;
                        return(PartialView("_Create", svm));
                    }

                    return(Json(new { success = true }));
                }
            }
            return(PartialView("_Create", svm));
        }