public async Task <IActionResult> PutCompanyMaster(Guid id, CompanyMaster companyMaster) { if (id != companyMaster.CompanyId) { return(BadRequest()); } _context.Entry(companyMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public CompanyMaster CompanyMaster_Retrieve(int id) { CompanyMaster obj = new CompanyMaster(); using (MySqlDataReader reader = ExecuteDataReader("CompanyMaster_Retrieve", CreateParameter("CompanyId_", MySqlDbType.Int32, id) )) { while (reader.Read()) { obj.CompanyId = Convert.ToInt32(reader["CompanyId"]); obj.CompanyName = reader["CompanyName"].ToString(); obj.CompanyPhoneNo = reader["CompanyPhoneNo"].ToString(); obj.CompanyWebsite = reader["CompanyWebsite"].ToString(); obj.CompanyAddress = reader["CompanyAddress"].ToString(); obj.CompanyCode = reader["CompanyCode"].ToString(); obj.CompanyEmailId = reader["CompanyEmailId"].ToString(); obj.OwnerName = reader["OwnerName"].ToString(); obj.OwnerEmailId = reader["OwnerEmailId"].ToString(); obj.OwnerPhone = reader["OwnerPhone"].ToString(); obj.CountryId = Convert.ToInt32(reader["CountryId"].ToString()); obj.StateId = Convert.ToInt32(reader["StateId"].ToString()); obj.DistrictId = Convert.ToInt32(reader["DistrictId"].ToString()); obj.CityId = Convert.ToInt32(reader["CityId"].ToString()); obj.IsActive = Convert.ToBoolean(reader["IsActive"]); obj.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]); } } return(obj); }
public DataBaseResultSet SaveCompanyMaster <T>(T objData) where T : class, IModel, new() { CompanyMaster obj = objData as CompanyMaster; string sQuery = "sprocCompanyMasterInsertUpdateSingleItem"; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("CompanyCode", "CompanyCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.CompanyCode)); list.Add(SqlConnManager.GetConnParameters("ICode", "ICode", 13, GenericDataType.String, ParameterDirection.Input, obj.ICode)); list.Add(SqlConnManager.GetConnParameters("CompanyName", "CompanyName", 50, GenericDataType.String, ParameterDirection.Input, obj.CompanyName)); list.Add(SqlConnManager.GetConnParameters("CompanyTag", "CompanyTag", 10, GenericDataType.String, ParameterDirection.Input, obj.CompanyTag)); list.Add(SqlConnManager.GetConnParameters("Add1", "Add1", 50, GenericDataType.String, ParameterDirection.Input, obj.Add1)); list.Add(SqlConnManager.GetConnParameters("Add2", "Add2", 50, GenericDataType.String, ParameterDirection.Input, obj.Add2)); list.Add(SqlConnManager.GetConnParameters("Add3", "Add3", 50, GenericDataType.String, ParameterDirection.Input, obj.Add3)); list.Add(SqlConnManager.GetConnParameters("CutExp", "CutExp", 3, GenericDataType.String, ParameterDirection.Input, obj.CutExp)); list.Add(SqlConnManager.GetConnParameters("CUser", "CUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.CUser)); list.Add(SqlConnManager.GetConnParameters("CDateTime", "CDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CDateTime)); list.Add(SqlConnManager.GetConnParameters("EUser", "EUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.EUser)); list.Add(SqlConnManager.GetConnParameters("EDateTime", "EDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.EDateTime)); list.Add(SqlConnManager.GetConnParameters("LCode", "LCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.LCode)); list.Add(SqlConnManager.GetConnParameters("DLock", "DLock", 3, GenericDataType.String, ParameterDirection.Input, obj.DLock)); list.Add(SqlConnManager.GetConnParameters("CreatedBy", "CreatedBy", 50, GenericDataType.String, ParameterDirection.Input, obj.CreatedBy)); list.Add(SqlConnManager.GetConnParameters("CreatedDate", "CreatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CreatedDate)); list.Add(SqlConnManager.GetConnParameters("UpdateddBy", "UpdateddBy", 50, GenericDataType.String, ParameterDirection.Input, obj.UpdateddBy)); list.Add(SqlConnManager.GetConnParameters("UpdatedDate", "UpdatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.UpdatedDate)); list.Add(SqlConnManager.GetConnParameters("UpdatedCount", "UpdatedCount", 4, GenericDataType.Int, ParameterDirection.Input, obj.UpdatedCount)); list.Add(SqlConnManager.GetConnParameters("LUT", "LUT", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.LUT)); list.Add(SqlConnManager.GetConnParameters("OperationFlag", "OperationFlag", 4, GenericDataType.Int, ParameterDirection.Input, (short)obj.OperationFlag)); list.Add(SqlConnManager.GetConnParameters("Message", "Message", 300, GenericDataType.String, ParameterDirection.Output, null)); list.Add(SqlConnManager.GetConnParameters("ErrorCode", "ErrorCode", 4, GenericDataType.Int, ParameterDirection.Output, null)); return(SqlConnManager.Save(sQuery, CommandType.StoredProcedure, list.ToArray())); }
public int Edit_ActiveCompanyMaster(CompanyMaster _user) { SqlParameter[] param = { new SqlParameter("@CompanyId", _user.CompanyId), new SqlParameter("@CompanyStatus", _user.CompanyStatus), new SqlParameter("@modifiedDate", _user.ModifiedDate) }; return(_da.Execute("Update_ActiveCompanyMaster", param)); }
// [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })] public JsonResult UploadIcon(CompanyMaster modal) { JsonResponse resp = new JsonResponse(); try { if (modal != null && modal.IconFile != null && modal.IconFile.Length > 0) { var filename = Path.Combine(modal.IconFile.FileName); var path = Path.Combine(_HostingEnvironment.WebRootPath, "Uploaded_Image", filename); using (var fileStream = new FileStream(path, FileMode.Create)) { modal.IconFile.CopyTo(fileStream); } resp.Data = filename; resp.Status = Constants.ResponseStatus.Success; } else if (modal.Icon != null && modal.ID != 0) { return(Json(_companyService.CheckImage(modal))); } else { resp.Message = Constants.ControllerMessage.Upload_Needed; } } catch (Exception ex) { resp.Message = Constants.ControllerMessage.Upload_Needed; } return(Json(resp)); }
protected void BtnDelete_Click(object sender, EventArgs e) { int DeleteId = 0; try { if (ViewState["EditID"] != null) { DeleteId = Convert.ToInt32(ViewState["EditID"]); } if (DeleteId != 0) { Entity_CM.CompanyId = DeleteId; Entity_CM.UserId = Convert.ToInt32(Session["UserID"]); Entity_CM.LoginDate = DateTime.Now; int iDelete = Obj_CM.DeleteRecord(ref Entity_CM, out StrError); if (iDelete != 0) { obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } } Entity_CM = null; Obj_CM = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
private void bindData() { IEnumerable <CompanyMaster> company = db.CompanyMasters.ToList(); if (company.Count() >= 2) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "toastr.error('Multiple Record found. Please contact with service engineer.');", true); } else { CompanyMaster _company = db.CompanyMasters.FirstOrDefault(x => x.Id == 1); if (_company != null) { txtCode.Text = _company.CompanyCode; txtAddress1.Text = _company.CompanyAddress1; txtAddress2.Text = _company.CompanyAddress2; txtContactEmail.Text = _company.ContactEmail; txtContactMobile.Text = _company.ContactMobile; txtContactPerson.Text = _company.ContactPerson; txtName.Text = _company.CompanyName; if (!string.IsNullOrEmpty(_company.CompanyLogo)) { companyLogo.Visible = true; companyLogo.ImageUrl = "/images/companylogo/" + _company.CompanyLogo; imgLogo.Value = _company.CompanyLogo; } } } }
public Result Create(CompanyMaster obj) { Result res = new Result(); try { using (var db = new OrderContext()) { db.CompanieMasters.Add( new CompanyMaster { Ext_Id = StringExtension.RandomString(20), Name = obj.Name, Code = obj.Code, UserCreated = Sesion.UserId, Created = DateTime.Now, Updated = DateTime.Now, UserUpdated = Sesion.UserId }); db.SaveChanges(); return(new Result { type = ResultType.SUCCESS }); } } catch (Exception e) { return(new Result { type = ResultType.FAILED, message = e.Message }); } }
public Result Update(string Ext_Id) { Result res = new Result(); CompanyMaster companyMaster = new CompanyMaster(); try { using (var db = new OrderContext()) { companyMaster = db.CompanieMasters.Where(c => c.Ext_Id.Equals(Ext_Id)).FirstOrDefault(); } if (companyMaster != null) { using (var db = new OrderContext()) { db.Entry(companyMaster).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } } return(new Result { type = ResultType.SUCCESS }); } catch (Exception e) { return(new Result { type = ResultType.FAILED, message = e.Message }); } }
public int Update(CompanyModel model) { Mapper.CreateMap <CompanyModel, CompanyMaster>(); CompanyMaster objUser = Dbcontext.CompanyMasters.SingleOrDefault(m => m.CompID == model.CompID); objUser = Mapper.Map(model, objUser); return(Dbcontext.SaveChanges()); }
public void GetListCompanyMaster <T>(T objFilter, ref List <T> listData) where T : class, IModel, new() { string sQuery = "GetListCompanyMaster"; CompanyMaster objData = objFilter as CompanyMaster; List <DbParameter> list = new List <DbParameter>(); list.Add(SqlConnManager.GetConnParameters("CompanyCode", "CompanyCode", 8, GenericDataType.Long, ParameterDirection.Input, objData.CompanyCode)); SqlConnManager.GetList <T>(sQuery, CommandType.StoredProcedure, list.ToArray(), FillCompanyMasterDataFromReader, ref listData); }
public List <CompanyMaster> CompanyMaster_Insert(CompanyMaster input) { List <CompanyMaster> listArea = new List <CompanyMaster>(); using (MySqlDataReader reader = ExecuteDataReader("CompanyMaster_InsertUpdateDelete", CreateParameter("CompanyId_", MySqlDbType.Int32, -1), CreateParameter("CompanyAddress_", MySqlDbType.VarChar, input.CompanyAddress), CreateParameter("CompanyCode_", MySqlDbType.VarChar, input.CompanyCode), CreateParameter("CompanyEmailId_", MySqlDbType.VarChar, input.CompanyEmailId), CreateParameter("CompanyName_", MySqlDbType.VarChar, input.CompanyName), CreateParameter("CompanyPhoneNo_", MySqlDbType.VarChar, input.CompanyPhoneNo), CreateParameter("CompanyWebsite_", MySqlDbType.VarChar, input.CompanyWebsite), CreateParameter("OwnerName_", MySqlDbType.DateTime, input.OwnerName), CreateParameter("OwnerEmailId_", MySqlDbType.VarChar, input.OwnerEmailId), CreateParameter("OwnerPhone_", MySqlDbType.VarChar, input.OwnerPhone), CreateParameter("CountryId_", MySqlDbType.Int32, input.CountryId), CreateParameter("StateId_", MySqlDbType.Int32, input.StateId), CreateParameter("DistrictId_", MySqlDbType.Int32, input.DistrictId), CreateParameter("CityId_", MySqlDbType.Int32, input.CityId), CreateParameter("Type_", MySqlDbType.Int32, 1))) { while (reader.Read()) { CompanyMaster obj = new CompanyMaster(); obj.CompanyId = Convert.ToInt32(reader["CompanyId"]); obj.CompanyName = reader["CompanyName"].ToString(); obj.CompanyPhoneNo = reader["CompanyPhoneNo"].ToString(); obj.CompanyWebsite = reader["CompanyWebsite"].ToString(); obj.CompanyAddress = reader["CompanyAddress"].ToString(); obj.CompanyCode = reader["CompanyCode"].ToString(); obj.CompanyEmailId = reader["CompanyEmailId"].ToString(); obj.OwnerName = reader["OwnerName"].ToString(); obj.OwnerEmailId = reader["OwnerEmailId"].ToString(); obj.OwnerPhone = reader["OwnerPhone"].ToString(); obj.CountryId = Convert.ToInt32(reader["CountryId"].ToString()); obj.StateId = Convert.ToInt32(reader["StateId"].ToString()); obj.DistrictId = Convert.ToInt32(reader["DistrictId"].ToString()); obj.CityId = Convert.ToInt32(reader["CityId"].ToString()); obj.IsActive = Convert.ToBoolean(reader["IsActive"]); obj.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]); listArea.Add(obj); } } return(listArea); }
public ReturnResult Post([FromBody] CompanyMaster objCompany) { CommonAPI commonApi = new CommonAPI(); commonApi.getHeaderValues(Request.Headers, out connectionString, out userAccount, out roleId, out companyCode, out DBProviderName); CompanyDAL companyDAL = new CompanyDAL(connectionString, userAccount, roleId, DBProviderName, companyCode); ReturnResult returnResult = companyDAL.SaveCompany(objCompany); return(returnResult); }
private void FillCompanyMasterDataFromReader <T>(DbDataReader DbReader, ref List <T> listData) where T : class, IModel, new() { while (DbReader.Read()) { T obj = new T(); CompanyMaster objData = obj as CompanyMaster; obj.FillDataFromDB(DbReader); listData.Add(obj); } }
public static CompanyMaster GetCompanyDetails(int id) { CompanyMaster c = new CompanyMaster(); c.ID = id; c.Name = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.FromName); c.PrimaryEmail = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.FromEmail); c.LogoUrl = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.LogoUrl); return(c); }
public async Task <ActionResult> Create(FormCollection collection) { ReturnResult returnResult = new ReturnResult(); CompanyMaster objCompany = new CompanyMaster(); try { // TODO: Add insert logic here CompanyBL objcompanyBL = new CompanyBL(); objCompany.CompanyId = 0; objCompany.CompanyCode = Convert.ToString(collection["CompanyCode"]); objCompany.CompanyName = Convert.ToString(collection["CompanyName"]); objCompany.Address = Convert.ToString(collection["Address"]); objCompany.City = Convert.ToString(collection["City"]); objCompany.ContactEmail = Convert.ToString(collection["City"]); objCompany.OwnedBy = Convert.ToString(collection["OwnedBy"]); objCompany.Phone1 = Convert.ToString(collection["Phone1"]); objCompany.Phone2 = Convert.ToString(collection["Phone2"]); objCompany.RegistrationNo = Convert.ToString(collection["RegistrationNo"]); objCompany.Tin = Convert.ToString(collection["Tin"]); objCompany.Website = Convert.ToString(collection["Website"]); WebAPI webapi = new WebAPI(); HttpResponseMessage response = await webapi.CallToWebAPI(APICallType.Post, "APICompany", "", Convert.ToString(Session["DBConnectionString"]), Convert.ToString(Session["UserAccount"]), Convert.ToString(Session["RoleId"]), Convert.ToString(Session["CompanyCode"]), "0", objCompany); if (response.IsSuccessStatusCode) { var data = await response.Content.ReadAsStringAsync(); // convert json in IEnumerable object list of category returnResult = JsonConvert.DeserializeObject <ReturnResult>(data); if (returnResult.IsSuccess) { return(RedirectToAction("Index")); } else { TempData["CreateCompanyMessage"] = returnResult.Message; return(View(objCompany)); } } else { TempData["CreateCompanyMessage"] = "Error while saving data."; return(View(objCompany)); } } catch { TempData["CreateCompanyMessage"] = returnResult.Message; return(View(objCompany)); } }
public IEnumerable <CompanyMaster> GetCustomerList() { List <CompanyMaster> customerList = new List <CompanyMaster>(); CompanyMaster customer; using (BraathenEiendomEntities entity = new BraathenEiendomEntities()) { string internalCustomersIds = Digimaker.Config.Custom.AppSettings["InternalCustomers"].ToString(); // "2038,4, 2037,2030"; var internalCustIds = internalCustomersIds.Split(',').ToArray(); string externalCostumersIds = Digimaker.Config.Custom.AppSettings["ExternalCostumers"].ToString(); //"3039"; var externalCustIds = externalCostumersIds.Split(',').ToArray(); var internalCustomerList = (from u in entity.OrganizationUnits where internalCustIds.Contains(u.ParentID.ToString()) select u).ToList(); var ExternalCustomerList = (from u in entity.OrganizationUnits where externalCustIds.Contains(u.ParentID.ToString()) select u).ToList(); foreach (var item in internalCustomerList) { customer = new CompanyMaster(); if (!string.IsNullOrEmpty(item.Code)) { customer.IsMVA = false; } else { customer.IsMVA = true; } customer.IsPrimary = true; customer.OrganizationUnitId = item.OrganizationUnitID.ToString(); customer.OrganizationUnitName = item.OrganizationUnitName; customerList.Add(customer); } foreach (var item in ExternalCustomerList) { customer = new CompanyMaster(); customer.IsPrimary = false; if (!string.IsNullOrEmpty(item.Code)) { customer.IsMVA = false; } else { customer.IsMVA = true; } customer.OrganizationUnitId = item.OrganizationUnitID.ToString(); customer.OrganizationUnitName = item.OrganizationUnitName; customerList.Add(customer); } } return(customerList); }
private void loadData(string Ext_Id) { CompanyMasterHelper hlp = new CompanyMasterHelper(); entity = hlp.Get(Ext_Id); if (entity != null) { NameText.Text = entity.Name; CodeText.Text = entity.Code; } }
protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0, InsertRowDtls = 0; try { if (ChkDetails() == true) { DS = Obj_CM.ChkDuplicate(TxtCompanyName.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("Record is Already Present..", this.Page); TxtCompanyName.Focus(); } else { Entity_CM.CompanyName = TxtCompanyName.Text; Entity_CM.abbreviation = Txtabbreviations.Text; Entity_CM.CAddress = TxtAddress.Text; Entity_CM.PhoneNo = TxtPhoneNo.Text.Trim(); Entity_CM.EmailId = TxtEmail.Text.Trim(); Entity_CM.Website = TxtWebsite.Text.Trim(); Entity_CM.FaxNo = TxtFaxNo.Text.Trim(); Entity_CM.TinNo = TxtTinNo.Text.Trim(); Entity_CM.VatNo = TxtVatNo.Text.Trim(); Entity_CM.ServiceTaxNo = TxtServiceTaxNo.Text.Trim(); Entity_CM.Note = TxtNoteC.Text.Trim(); Entity_CM.UserId = Convert.ToInt32(Session["UserId"]); Entity_CM.LoginDate = DateTime.Now; InsertRow = Obj_CM.InsertRecord(ref Entity_CM, out StrError); if (InsertRow > 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_CM = null; Obj_CM = null; } } } else { obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public IActionResult Put([FromBody] CompanyMaster req) { bool result = _repo.Update(req); if (result) { return(Ok("Success")); } return(Ok("Fail")); }
public static CompanyMaster GetCompanyDetails(int id) { CompanyMaster c = new CompanyMaster(); c.ID = id; c.Name = getConfigValue(id, AspectEnums.ConfigKeys.FromName); c.PrimaryEmail = getConfigValue(id, AspectEnums.ConfigKeys.FromEmail); c.LogoUrl = getConfigValue(id, AspectEnums.ConfigKeys.LogoUrl); c.PhoneNumber = getConfigValue(id, AspectEnums.ConfigKeys.Phone); return(c); }
public long InsertUpdateCompanyDetails(CompanyBE.CompanyMasterBE lst) { if (lst.CompanyID != 0) { var lstCompany = _ObjEINS_RBMSEntities.CompanyMasters.FirstOrDefault(x => x.CompanyID == lst.CompanyID); lstCompany.CompanyName = lst.CompanyName; lstCompany.CompanyBuilding = lst.CompanyBuilding; lstCompany.CompanyHead = lst.CompanyHead; lstCompany.CompanyAlias = lst.CompanyAlias; lstCompany.Street = lst.Street; lstCompany.City = lst.City; lstCompany.Pincode = lst.Pincode; lstCompany.CountryId = lst.CountryId; lstCompany.StateId = lst.StateId; lstCompany.CompanyEmailid = lst.CompanyEmailid; lstCompany.CompanyTelephone = lst.CompanyTelephone; lstCompany.CompanyFax = lst.CompanyFax; lstCompany.CompanyWebsite = lst.CompanyWebsite; lstCompany.CompanyLogo = lst.CompanyLogo; lstCompany.Status = true; lstCompany.LastModifiedBy = lst.LastModifiedBy; lstCompany.LastModifiedOn = DateTime.Now; _ObjEINS_RBMSEntities.SaveChanges(); return(lst.CompanyID); } else { CompanyMaster _ObjCompanyMaster = new CompanyMaster(); _ObjCompanyMaster.CompanyName = lst.CompanyName; _ObjCompanyMaster.CompanyBuilding = lst.CompanyBuilding; _ObjCompanyMaster.CompanyHead = lst.CompanyHead; _ObjCompanyMaster.CompanyAlias = lst.CompanyAlias; _ObjCompanyMaster.Street = lst.Street; _ObjCompanyMaster.City = lst.City; _ObjCompanyMaster.Pincode = lst.Pincode; _ObjCompanyMaster.CountryId = lst.CountryId; _ObjCompanyMaster.StateId = lst.StateId; _ObjCompanyMaster.CompanyEmailid = lst.CompanyEmailid; _ObjCompanyMaster.CompanyTelephone = lst.CompanyTelephone; _ObjCompanyMaster.CompanyFax = lst.CompanyFax; _ObjCompanyMaster.CompanyWebsite = lst.CompanyWebsite; _ObjCompanyMaster.CompanyLogo = lst.CompanyLogo; _ObjCompanyMaster.Status = true; _ObjCompanyMaster.AddedBy = lst.AddedBy; _ObjCompanyMaster.AddedOn = DateTime.Now; _ObjEINS_RBMSEntities.AddToCompanyMasters(_ObjCompanyMaster); _ObjEINS_RBMSEntities.SaveChanges(); return(_ObjCompanyMaster.CompanyID); } }
// GET: Branch public ActionResult New(int CompanyId) { CompanyMaster comp = new CompanyMaster(); comp = comp.GetComapnyById(CompanyId)[0]; CompanyProfile compProfile = new CompanyProfile() { companyMaster = comp, company = comp.company }; return(View("BranchForm", compProfile)); }
private void frmCompany_FormClosing(object sender, FormClosingEventArgs e) { try { if (dgvCompanyList.CurrentRow != null) { this.LastSelectedCompany = dgvCompanyList.CurrentRow.DataBoundItem as CompanyMaster; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public CompanyMaster GetCompanyById(int CompanyID) { List <CompanyMaster> companyList = new List <CompanyMaster>(); // List<IBSparameter> parameters = new List<IBSparameter>(); try { if (DBProvider == ProviderName.SqlClient) { IBSparameter Userparameter = new IBSparameter(); Userparameter.ParameterName = "@UserAccount"; Userparameter.DataType = DbType.String; Userparameter.Value = LoggedInUser; Userparameter.Direction = ParameterDirection.Input; parameters.Add(Userparameter); IBSparameter CompanyIdParameter = new IBSparameter(); CompanyIdParameter.ParameterName = "@CompanyID"; CompanyIdParameter.DataType = DbType.String; CompanyIdParameter.Value = CompanyID; CompanyIdParameter.Direction = ParameterDirection.Input; parameters.Add(CompanyIdParameter); } DataSet dsCategory = null; dsCategory = GetDataSet("ERP_Get_CompanyByID", parameters); var CompanyCollection = from CompanyMaster in dsCategory.Tables[0].AsEnumerable() select new CompanyMaster { CompanyId = CompanyMaster.Field <int>("CompanyID"), CompanyCode = CompanyMaster.Field <String>("CompanyCode"), CompanyName = CompanyMaster.Field <String>("CompanyName"), RegistrationNo = CompanyMaster.Field <String>("RegistrationNo"), City = CompanyMaster.Field <String>("City"), Address = CompanyMaster.Field <String>("Address"), }; companyList = CompanyCollection.ToList <CompanyMaster>(); } catch (Exception ex) { //Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex); } return(companyList[0]); }
public int InsertComp(CompanyModel model) { try { Mapper.CreateMap <CompanyModel, CompanyMaster>(); CompanyMaster objUser = Mapper.Map <CompanyMaster>(model); Dbcontext.CompanyMasters.Add(objUser); return(Dbcontext.SaveChanges()); } catch (Exception ex) { throw ex; } }
public CompanyModel getByID(int id) { try { Mapper.CreateMap <CompanyMaster, CompanyModel>(); CompanyMaster objCityMaster = Dbcontext.CompanyMasters.Where(m => m.CompID == id).SingleOrDefault(); CompanyModel objCityItem = Mapper.Map <CompanyModel>(objCityMaster); return(objCityItem); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { try { CompanyMaster company = db.CompanyMasters.FirstOrDefault(x => x.Id == 1); if (company == null) { company = new CompanyMaster(); company.CompanyAddress1 = txtAddress1.Text; company.CompanyAddress2 = txtAddress2.Text; company.CompanyName = txtName.Text; company.CompanyCode = txtCode.Text; company.ContactEmail = txtContactEmail.Text; company.ContactMobile = txtContactMobile.Text; company.ContactPerson = txtContactPerson.Text; if (upload1.HasFile) { string filename = upload1.PostedFile.FileName; upload1.SaveAs(Server.MapPath("~/images/companylogo/") + upload1.PostedFile.FileName); company.CompanyLogo = filename; } db.CompanyMasters.InsertOnSubmit(company); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "toastr.success('Company record added successfully.');", true); } else { company.CompanyAddress1 = txtAddress1.Text; company.CompanyAddress2 = txtAddress2.Text; company.CompanyName = txtName.Text; company.CompanyCode = txtCode.Text; company.ContactEmail = txtContactEmail.Text; company.ContactMobile = txtContactMobile.Text; company.ContactPerson = txtContactPerson.Text; if (upload1.HasFile) { string filename = upload1.PostedFile.FileName; upload1.SaveAs(Server.MapPath("~/images/companylogo/") + upload1.PostedFile.FileName); company.CompanyLogo = filename; } ClientScript.RegisterStartupScript(this.GetType(), "myalert", "toastr.success('Company record updated successfully.');", true); } db.SubmitChanges(); bindData(); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "toastr.error('" + ex.Message.ToString() + "');", true); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { int UpdateRow = 0, InsertRowDtls = 0; try { if (ChkDetails() == true) { if (ViewState["EditID"] != null) { Entity_CM.CompanyId = Convert.ToInt32(ViewState["EditID"]); } Entity_CM.CompanyName = TxtCompanyName.Text; Entity_CM.abbreviation = Txtabbreviations.Text; Entity_CM.CAddress = TxtAddress.Text; Entity_CM.PhoneNo = TxtPhoneNo.Text.Trim(); Entity_CM.EmailId = TxtEmail.Text.Trim(); Entity_CM.Website = TxtWebsite.Text.Trim(); Entity_CM.FaxNo = TxtFaxNo.Text.Trim(); Entity_CM.TinNo = TxtTinNo.Text.Trim(); Entity_CM.VatNo = TxtVatNo.Text.Trim(); Entity_CM.ServiceTaxNo = TxtServiceTaxNo.Text.Trim(); Entity_CM.Note = TxtNoteC.Text.Trim(); Entity_CM.UserId = Convert.ToInt32(Session["UserId"]); Entity_CM.LoginDate = DateTime.Now; UpdateRow = Obj_CM.UpdateRecord(ref Entity_CM, out StrError); if (UpdateRow > 0) { obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page); MakeEmptyForm(); Entity_CM = null; Obj_CM = null; } } else { obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void FillFormForUpdate() { CompanyMaster company = applicationFacade.GetCompanyById(this.CompanyId); if (company != null) { txtCompanyCode.Text = company.CompanyCode; txtCompanyName.Text = company.CompanyName; txtBillingPrefRating.Text = company.BillingPreferenceRating.ToString(); txtOrderPrefRating.Text = company.OrderPreferenceRating.ToString(); cbxDI.SelectedItem = company.IsDirect ? Enums.DI.Direct : Enums.DI.Indirect; cbxSSRequired.SelectedItem = company.StockSummaryRequired ? Enums.Choice.Yes : Enums.Choice.No; cbxStatus.SelectedItem = company.Status ? Enums.Status.Active : Enums.Status.Inactive; } }