protected void btnSave_Click(object sender, EventArgs e) { CostCenter objCenter=new CostCenter(); objCenter.CostCenterType = txtCostCenterType.Value; objCenter.CostCenterName = txtCostCentreName.Value; objCenter.IsActive = chkIsActive.Checked; objCenter.CompanyId = _company.CompanyId; objCenter.UpdateBy = _user.UserId; objCenter.UpdateDate=DateTime.Now.Date; int sucess = 0; if (lblId.Text == "" || lblId.Text == "0") { objCenter.CostCenterId = new CostCenter().GetMaxCostCenterId() + 1; sucess = objCenter.InsertCostCenter(); if (sucess > 0) { Alert.Show("Cost Center saved successfully"); } } else { objCenter.CostCenterId = int.Parse(lblId.Text); sucess = objCenter.UpdateCostCenter(); if (sucess > 0) { Response.Redirect("CostCenterList.aspx", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { CostCenter objCenter=new CostCenter(); objCenter.CostCenterId = listCenter.Count; objCenter.CostCenterType = txtCostCenterType.Value; objCenter.CostCenterName = txtCostCentreName.Value; objCenter.IsActive = chkIsActive.Checked; objCenter.CompanyId = _company.CompanyId; objCenter.UpdateBy = _user.UserId; objCenter.UpdateDate=DateTime.Now.Date; int success = objCenter.InsertCostCenter(); if (success > 0) { Alert.Show("Cost Center Inserted"); this.GetAllCostCentre(); this.LoadCostCentreTable(); } }