/// <summary> /// Add parameters while fetch or supplier search items /// </summary> /// <param name="users"></param> /// <returns></returns> public IDbDataParameter[] AddParametersGetSupplierMaster(SupplierMaster supplier_master) { parameters.Clear(); parameters.Add(dbManager.CreateParameter("@SupplierName", 150, supplier_master.SupplierName, DbType.String)); parameters.Add(dbManager.CreateParameter("@SupplierCode", 50, supplier_master.SupplierCode, DbType.Int32)); return(parameters.ToArray()); }
public IHttpActionResult UpdateSupplier(SupplierMaster supplier) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { // var objGM = new GaugeTypeMaster(); var objGM = new SupplierMaster(); objGM = objEntity.SupplierMasters.Find(supplier.ID); if (objGM != null) { objGM.ID = supplier.ID; objGM.SupplierName = supplier.SupplierName; objGM.Address = supplier.Address; objGM.EmailId = supplier.EmailId; objGM.ContactPersonName = supplier.ContactPersonName; objGM.ContactNumber = supplier.ContactNumber; } int i = this.objEntity.SaveChanges(); } catch (Exception ex) { throw ex; } return(Ok(supplier)); }
public ActionResult Create(SupplierMaster supplier) { int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString()); int companyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); //if (ModelState.IsValid) //{ //ViewBag.country = DropDownList<CountryMaster>.LoadItems( //ObjectSourceModel.GetCountry(), "CountryID", "CountryName"); var supplierMasterTypes = (from d in db.SupplierTypes select d).ToList(); ViewBag.SupplierType = supplierMasterTypes; var query = (from t in db.SupplierMasters where t.SupplierName == supplier.SupplierName select t).ToList(); if (query.Count > 0) { ViewBag.SuccessMsg = "Supplier name is already exist"; return(View()); } supplier.BranchID = branchid; supplier.AcCompanyID = companyid; //supplier.SupplierID = ObjectSourceModel.GetMaxNumberSupplier(); db.SupplierMasters.Add(supplier); db.SaveChanges(); ReceiptDAO.ReSaveSupplierCode(); ViewBag.SuccessMsg = "You have successfully added Supplier."; return(RedirectToAction("Index")); //} }
public void updateSupplierDetails() { try { SupplierMaster suplier = new SupplierMaster(); suplier.supplierId = Convert.ToInt32(txtSupplierId.Text); suplier.supplierName = txtSupplierName.Text; suplier.supplierStatus = cmbStatus.Text == "Active" ? 1 : 0; supplier = new SupplierMasterBL(); if (supplier.updateSupplierDetails(suplier) > 0) { MessageBox.Show("Record is Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Record is Not Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("Record is Not Updated", "Information", MessageBoxButtons.OK); string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex); ErrorHandling.Class1.LogFileWrite(errorMessage); } }
public void DeleteItemMaster() { try { var supplier_master = new SupplierMaster { SupplierCode = SelectedSupplierCode, SupplierName = "", MobileNumber = 0, EmailId = "", GSTINNumber = "", Address1 = "", Address2 = "", OperationType = 3 }; int DeleteStatus = _instanceRepository.InsertUpdateDeleteSupplierLegder(supplier_master); if (DeleteStatus >= 1) { messageShow.singlemsgtext("Deleted Successfully"); } else { messageShow.singlemsgtext("Unable to Delete"); } GetSupplierLedgerList("", 0); ResetControllers(); } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
/// <summary> /// Insert/update/delete the new supplier details.. /// </summary> /// <param name="users"></param> /// <returns></returns> public int InsertUpdateDeleteSupplierLegder(SupplierMaster supplier_master) { int LastId = 0; var DbManager = new DBManager("DBConnection"); DbManager.Insert(_StoredProcedures.InsertUpdateDeleteSupplierLedger_SP, CommandType.StoredProcedure, _AdminMasterIRepository.AddParametersSupplierLedger(supplier_master), out LastId); return(LastId); }
private void mnuSupplierMaster_Click(object sender, RoutedEventArgs e) { supplierMaster = SupplierMaster.Instance; supplierMaster.Show(); supplierMaster.Focus(); }
public ActionResult EditPartial(SupplierMaster suppmaster) { suppmaster.Status = "Active"; suppmaster.ModifiedOn = DateTime.Now; //save multiple values in database _suppliermasterservice.UpdateSupplier(suppmaster); return(RedirectToAction("ResultSupplierMaster/" + suppmaster.SupplierId, "Supplier")); }
public void EditSupplierMaster_Data(SupplierMaster suppliermaster, string username, string password) { SupplierMaster suplir_Mstr = context.SupplierMaster.FirstOrDefault(a => a.SupplierCode == suppliermaster.SupplierCode); suplir_Mstr.SupplierName = suppliermaster.SupplierName; suplir_Mstr.Location = suppliermaster.Location; suplir_Mstr.ModifiedBy = username; suplir_Mstr.ModifiedDate = DateTime.Now; }
// // GET: /Supplier/Delete/5 //public ActionResult Delete(int id = 0) //{ // Supplier supplier = db.Suppliers.Find(id); // if (supplier == null) // { // return HttpNotFound(); // } // return View(supplier); //} // // POST: /Supplier/Delete/5 public ActionResult DeleteConfirmed(int id) { SupplierMaster supplier = db.SupplierMasters.Find(id); db.SupplierMasters.Remove(supplier); db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully deleted supplier."; return(RedirectToAction("Index")); }
public IHttpActionResult UpdateSupplierMaster(SupplierMaster suppliermaster) { var isupdate = _suppliermasterRepository.UpdateSupplierMaster(suppliermaster); if (isupdate == true) { return(Ok(isupdate)); } return(BadRequest()); }
// // GET: /Supplier/Details/5 public ActionResult Details(int id = 0) { SupplierMaster supplier = db.SupplierMasters.Find(id); if (supplier == null) { return(HttpNotFound()); } return(View(supplier)); }
private void BtnInsertUpdate_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtSName.Text.ToString())) { messageShow.singlemsgtext("Supplier name should not be empty"); TxtSName.Focus(); return; } if (string.IsNullOrEmpty(TxtSMobNum.Text.ToString())) { messageShow.singlemsgtext("Supplier mobile number should not be empty"); TxtSMobNum.Focus(); return; } if (string.IsNullOrEmpty(TxtSEmailId.Text.ToString())) { messageShow.singlemsgtext("Email id should not be empty"); TxtSEmailId.Focus(); return; } if (string.IsNullOrEmpty(TxtSGSTNum.Text.ToString())) { messageShow.singlemsgtext("GSTIN number should not be empty"); TxtSGSTNum.Focus(); return; } if (string.IsNullOrEmpty(TxtArSAddrOne.Text.ToString())) { messageShow.singlemsgtext("Address should not be empty"); TxtArSAddrOne.Focus(); return; } var supplier_master = new SupplierMaster { SupplierCode = SelectedSupplierCode, SupplierName = TxtSName.Text.ToString(), MobileNumber = Convert.ToInt64(TxtSMobNum.Text.ToString()), EmailId = TxtSEmailId.Text.ToString(), GSTINNumber = TxtSGSTNum.Text.ToString(), Address1 = TxtArSAddrOne.Text.ToString(), Address2 = TxtArSAddrTwo.Text.ToString(), OperationType = SelectedSupplierCode == 0 ? 1 : 2 }; int id = _instanceRepository.InsertUpdateDeleteSupplierLegder(supplier_master); supplier_master.SupplierName = ""; ResetControllers(); } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
public IHttpActionResult DeleteSupplier(int id) { SupplierMaster master = objEntity.SupplierMasters.Find(id); if (master == null) { return(NotFound()); } objEntity.SupplierMasters.Remove(master); objEntity.SaveChanges(); return(Ok(master)); }
/// <summary> /// Add parameters while adding the product details /// </summary> /// <param name="users"></param> /// <returns></returns> public IDbDataParameter[] AddParametersSupplierLedger(SupplierMaster supplier_master) { parameters.Clear(); parameters.Add(dbManager.CreateParameter("@SupplierCode", 50, supplier_master.SupplierCode, DbType.Int32)); parameters.Add(dbManager.CreateParameter("@SupplierName", 150, supplier_master.SupplierName, DbType.String)); parameters.Add(dbManager.CreateParameter("@MobileNumber", 18, supplier_master.MobileNumber, DbType.Int64)); parameters.Add(dbManager.CreateParameter("@EmailId", 30, supplier_master.EmailId, DbType.String)); parameters.Add(dbManager.CreateParameter("@GSTINNumber", 30, supplier_master.GSTINNumber, DbType.String)); parameters.Add(dbManager.CreateParameter("@Address1", 150, supplier_master.Address1, DbType.String)); parameters.Add(dbManager.CreateParameter("@Address2", 150, supplier_master.Address2, DbType.String)); parameters.Add(dbManager.CreateParameter("@OperationType", 2, supplier_master.OperationType, DbType.Int16)); return(parameters.ToArray()); }
// // GET: /Supplier/Edit/5 public ActionResult Edit(int id = 0) { var data = db.RevenueTypes.ToList(); ViewBag.revenue = data; ViewBag.AcHead = db.AcHeads.OrderBy(c => c.AcHead1).ToList(); SupplierMaster supplier = db.SupplierMasters.Find(id); var supplierMasterTypes = (from d in db.SupplierTypes select d).ToList(); ViewBag.SupplierType = supplierMasterTypes; return(View(supplier)); }
public bool validateControls() { int id; string ErrorString = ""; SupplierMaster supplierEntities = new SupplierMaster(); try { supplierEntities.supplierId = int.TryParse(txtSupplierId.Text, out id) == true ? id : 0; supplierEntities.supplierName = txtSupplierName.Text; supplierEntities.supplierStatus = cmbStatus.SelectedIndex; supplier = new SupplierMasterBL(); ErrorString = supplier.ValidationOfControls(supplierEntities); if (!string.IsNullOrEmpty(ErrorString)) { if (ErrorString == "txtSupplierId") { MessageBox.Show("Supplier Id Cannot be Empty!!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSupplierId.Focus(); return(false); } else if (ErrorString == "txtSupplierName") { MessageBox.Show("Supplier Name Cannot be Empty!!! OR It Cannot Exceed 10 Characters...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSupplierName.Focus(); return(false); } else if (ErrorString == "cmbStatus") { MessageBox.Show("Supplier Status Cannot be Empty!!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbStatus.Select(); return(false); } } } catch (Exception ex) { string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex); ErrorHandling.Class1.LogFileWrite(errorMessage); return(false); } return(true); }
public String ValidationOfControls(SupplierMaster supplier) { string errorString = ""; int count = 0; try { if (supplier.supplierId == 0) { errorString = "txtSupplierId"; return(errorString); } else if (supplier.supplierName == "") { errorString = "txtSupplierName"; return(errorString); } else if (supplier.supplierName != "") { foreach (char c in supplier.supplierName) { count++; } if (count > 10) { errorString = "txtSupplierName"; return(errorString); } } else if (supplier.supplierStatus == -1) { errorString = "cmbStatus"; return(errorString); } return(errorString); } catch (Exception ex) { string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex); ErrorHandling.Class1.LogFileWrite(errorMessage); return(errorString); } }
public ActionResult DeletePartial(SupplierMaster suppmaster) { suppmaster.Status = "InActive"; suppmaster.ModifiedOn = DateTime.Now; _suppliermasterservice.UpdateSupplier(suppmaster); var BankList = _SupplierBankDetailService.GetDetailsFromBank(suppmaster.SupplierCode); foreach (var bank in BankList) { bank.Status = "InActive"; bank.ModifiedOn = DateTime.Now; _SupplierBankDetailService.UpdateBankDetails(bank); } return(RedirectToAction("ResultSupplierMaster/" + suppmaster.SupplierId, "Supplier")); }
public bool UpdateSupplierMaster(SupplierMaster suppliermaster) { //suppliermaster.CreatedDate = now; //suppliermaster.ModifiedDate = now; int rowsAffected = this._db.Execute( "UPDATE SupplierMaster SET Name = @Name,Address=@Address,EmailId=@EmailId,PhoneNumber=@PhoneNumber,AlternatePhoneNumber=@AlternatePhoneNumber,FaxNumber=@FaxNumber,ModifiedDate=@ModifiedDate,SupplierTypeId = @SupplierTypeId WHERE Id =" + suppliermaster.Id, suppliermaster); if (rowsAffected > 0) { return(true); } return(false); }
public int updateSupplierDetails(SupplierMaster supplierDetails) { try { supplier = new SupplierMasterDA(); return(supplier.updateSupplierDetailsToDB(supplierDetails)); } catch (Exception ex) { string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex); ErrorHandling.Class1.LogFileWrite(errorMessage); return(-1); } }
public IHttpActionResult InsertSupplier(SupplierMaster supplier) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { objEntity.SupplierMasters.Add(supplier); objEntity.SaveChanges(); } catch (Exception ex) { throw ex; } return(Ok(supplier)); }
public bool CreateSupplierMaster(SupplierMaster suppliermaster) { suppliermaster.CreatedDate = now; suppliermaster.ModifiedDate = now; int rowsAffected = this._db.Execute(@"INSERT SupplierMaster(Name,Address,EmailId,PhoneNumber,AlternatePhoneNumber,FaxNumber,IsActive,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,SupplierTypeId) values (@Name,@Address,@EmailId,@PhoneNumber,@AlternatePhoneNumber,@FaxNumber,1,1,@CreatedDate,1,@ModifiedDate,@SupplierTypeId)", new { Name = suppliermaster.Name, Address = suppliermaster.Address, EmailId = suppliermaster.EmailId, PhoneNumber = suppliermaster.PhoneNumber, AlternatePhoneNumber = suppliermaster.AlternatePhoneNumber, FaxNumber = suppliermaster.FaxNumber, IsActive = 1, CreatedBy = 1, CreatedDate = suppliermaster.CreatedDate, ModifiedBy = suppliermaster.ModifiedBy, ModifiedDate = suppliermaster.ModifiedDate, SupplierTypeId = suppliermaster.SupplierTypeId }); if (rowsAffected > 0) { return(true); } return(false); }
public JsonResult LoadDistrictByState(string statename) { if (!string.IsNullOrEmpty(statename)) { int stateid = _stateservice.GetStateIdByName(statename); SupplierMaster suppmaster = new SupplierMaster(); suppmaster.DistrictsList = _districtservice.getDistrictbyState(stateid); var modelData = suppmaster.DistrictsList.Select(m => new SelectListItem() { Text = m.DistrictName, Value = m.DistrictId.ToString() }); return(Json(modelData, JsonRequestBehavior.AllowGet)); } else { var modelData = string.Empty; return(Json(modelData, JsonRequestBehavior.AllowGet)); } }
public JsonResult LoadStateByCountry(string countryname) { if (!string.IsNullOrEmpty(countryname)) { int countryid = _countryservice.getidbyname(countryname); SupplierMaster suppmaster = new SupplierMaster(); suppmaster.StatesList = _stateservice.GetStateByCountry(countryid); var modelData = suppmaster.StatesList.Select(m => new SelectListItem() { Text = m.StateName, Value = m.StateName }); return(Json(modelData, JsonRequestBehavior.AllowGet)); } else { var modelData = string.Empty; return(Json(modelData, JsonRequestBehavior.AllowGet)); } }
public ActionResult Edit(SupplierMaster supplier) { int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString()); int companyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); if (ModelState.IsValid) { supplier.AcCompanyID = companyid; supplier.BranchID = branchid; db.Entry(supplier).State = EntityState.Modified; db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully updated Supplier."; return(RedirectToAction("Index")); } else { var supplierMasterTypes = (from d in db.SupplierTypes select d).ToList(); ViewBag.SupplierType = supplierMasterTypes; } return(View(supplier)); }
public int updateSupplierDetailsToDB(SupplierMaster supplier) { try { using (SqlCommand cmd = new SqlCommand("spUpdateSupplierDetails", conectn.ActiveCon())) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SupplierId", supplier.supplierId); cmd.Parameters.AddWithValue("@SupplierName", supplier.supplierName); cmd.Parameters.AddWithValue("@SupplierStatus", supplier.supplierStatus); int count = cmd.ExecuteNonQuery(); return(count); } } catch (Exception ex) { string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex); ErrorHandling.Class1.LogFileWrite(errorMessage); return(-1); } }
public void DeleteSupplier(SupplierMaster Supplier) { _SupplierMasterRepository.Delete(Supplier); _unityOfWork.Commit(); }
public void EditSupplierMaster_Data(SupplierMaster suppliermaster, string username, string password) { masterReports.EditSupplierMaster_Data(suppliermaster, username, password); }
/// <summary> /// To get the supplier ledger list.. /// </summary> /// <param name="users"></param> /// <returns></returns> public DataTable GetSupplierLedger(SupplierMaster supplier_master) { var DbManager = new DBManager("DBConnection"); return(DbManager.GetDataTable(_StoredProcedures.GetSupplierLedger_SP, CommandType.StoredProcedure, _AdminMasterIRepository.AddParametersGetSupplierMaster(supplier_master))); }