public static bool IsCodeAvailable(entitiesEvolveCentral ctx, string value, int?id) { bool retval = true; try { DAL.CompanyItem item = (from i in ctx.CompanyItems where i.Code.ToUpper() == value.ToUpper() select i).FirstOrDefault(); if (item != null) { if (id == null) { retval = false; } if (id != null && item.Id != id) { retval = false; } } } catch (Exception ex) { ApplicationLog.Log(ctx, "DAL.Company.IsCodeAvailable(entitiesEvolveCentral ctx, string value, int? id)", ex.Message); retval = false; } return(retval);; }
void DeleteItem(int itemid) { DAL.CompanyItem item = DAL.Company.Get(ctx, itemid); bool succeded = DAL.Company.Delete(ctx, item); rgvData.Rebind(); }
void LoadData() { string id = (Request.QueryString["id"] != null && !string.IsNullOrEmpty(Request.QueryString["id"])) ? Request.QueryString["id"].ToString() : null; DAL.CompanyItem item = DAL.Company.Get(ctx, Convert.ToInt32(id)); if (item != null) { txtId.Text = item.Id.ToString(); txtCode.Text = item.Code; txtName.Text = item.Name; txtContact.Text = item.Contact; chkActive.Checked = item.Active; } }
void LoadData() { string id = GetId(); DAL.CompanyItem item = DAL.Company.Get(ctx, Convert.ToInt32(id)); if (item != null) { txtId.Text = item.Id.ToString(); txtCode.Text = item.Code; txtName.Text = item.Name; txtContact.Text = item.Contact; txtActive.Text = (item.Active) ? "Yes" : "No"; } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (isValid()) { DAL.CompanyItem item = new DAL.CompanyItem(); //if (id != null) // item = DAL.Company.GetByID(ctx, (Int32)id); item.Active = chkActive.Checked; item.Code = txtCode.Text; item.Name = txtName.Text; item.Contact = txtContact.Text; DAL.Company.Save(ctx, item); Response.Redirect(Request.QueryString["returnurl"]); } }
bool Save() { if (!IsValid()) { return(false); } DateTime currentdate = DateTime.Now; var item = new DAL.CompanyItem(); item.Code = txtCode.Text; item.Name = txtName.Text; item.Contact = txtContact.Text; item.Active = chkActive.Checked; bool succeeded = DAL.Company.Save(ctx, item); return(succeeded); }
bool Save() { if (!IsValid()) { return(false); } DateTime currentdate = DateTime.Now; id = GetId(); DAL.CompanyItem item = DAL.Company.Get(ctx, Convert.ToInt32(id)); item.Code = txtCode.Text; item.Name = txtName.Text; item.Active = chkActive.Checked; item.Contact = txtContact.Text; bool succeeded = DAL.Company.Save(ctx, item); return(succeeded); }