//Sin e: GetCustomerByOID //Con e: CustomerEN public CustomerEN GetCustomerByOID(string idnumber) { CustomerEN customerEN = null; try { SessionInitializeTransaction(); customerEN = (CustomerEN)session.Get(typeof(CustomerEN), idnumber); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CustomerCAD.", ex); } finally { SessionClose(); } return(customerEN); }
public void DeleteCustomer(string idnumber) { try { SessionInitializeTransaction(); CustomerEN customerEN = (CustomerEN)session.Load(typeof(CustomerEN), idnumber); session.Delete(customerEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CustomerCAD.", ex); } finally { SessionClose(); } }
public string CreateCustomer(string p_idnumber, string p_firstName, string p_email, string p_password, string p_lastName, string p_address, string p_telephone, string p_zip) { CustomerEN customerEN = null; string oid; //Initialized CustomerEN customerEN = new CustomerEN(); customerEN.Idnumber = p_idnumber; customerEN.FirstName = p_firstName; customerEN.Email = p_email; customerEN.Password = p_password; customerEN.LastName = p_lastName; customerEN.Address = p_address; customerEN.Telephone = p_telephone; customerEN.Zip = p_zip; //Call to CustomerCAD oid = _ICustomerCAD.CreateCustomer(customerEN); return(oid); }
public string CreateCustomer(CustomerEN customer) { try { SessionInitializeTransaction(); session.Save(customer); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CustomerCAD.", ex); } finally { SessionClose(); } return(customer.Idnumber); }
public static CustomerEN SearchEmp(string C_ID) { StringBuilder sql = new StringBuilder(); sql.AppendLine("select * from dbo.Customer"); sql.AppendLine("where C_ID = '" + C_ID + "'"); DataTable dt = ClassMain.ExecuteComandTable(sql.ToString()); CustomerEN en = new CustomerEN(); if (dt != null && dt.Rows.Count > 0) { DataRow dr = (DataRow)dt.Rows[0]; en.C_ID = Convert.ToString(dr["C_ID"]); en.Name = Convert.ToString(dr["Name"]); en.Tel = Convert.ToString(dr["Tel"]); en.Email = Convert.ToString(dr["Email"]); en.Fax = Convert.ToString(dr["Fax"]); en.Name_Company = Convert.ToString(dr["Name_Company"]); en.Address = Convert.ToString(dr["Address"]); en.Tel_Company = Convert.ToString(dr["Tel_Company"]); en.Tax_Number = Convert.ToString(dr["Tax_Number"]); en.UpdatedBy = Convert.ToString(dr["UpdatedBy"]); en.CreatedBy = Convert.ToString(dr["CreatedBy"]); en.UpdatedDate = Convert.ToDateTime(Utilities.SetDefaultValue(dr["UpdatedDate"], DateTime.MinValue)); en.CreatedDate = Convert.ToDateTime(Utilities.SetDefaultValue(dr["CreatedDate"], DateTime.MinValue)); } return(en); }
public CustomerEN GetCustomerByOID(string idnumber) { CustomerEN customerEN = null; customerEN = _ICustomerCAD.GetCustomerByOID(idnumber); return(customerEN); }
public static ResultEN Update(CustomerEN en) { ResultEN res = new ResultEN(); List <ClassFieldValue> fields = new List <ClassFieldValue>(); fields.Add(new ClassFieldValue("UpdatedBy", HttpContext.Current.User.Identity.Name)); fields.Add(new ClassFieldValue("UpdatedDate", DateTime.Now)); SetField(fields, en); List <ClassFieldValue> fieldscon = new List <ClassFieldValue>(); fieldscon.Add(new ClassFieldValue("C_ID", en.C_ID)); res = ClassMain.Update(tb_name, fields, fieldscon); return(res); }
public static ResultEN Insert(CustomerEN en) { ResultEN res = new ResultEN(); // Gen Employee code string C_ID = GetC_ID(); List <ClassFieldValue> fields = new List <ClassFieldValue>(); en.C_ID = C_ID; //fields.Add(new ClassFieldValue("C_ID", C_ID)); fields.Add(new ClassFieldValue("CreatedBy", HttpContext.Current.User.Identity.Name)); fields.Add(new ClassFieldValue("CreatedDate", DateTime.Now)); SetField(fields, en); res = ClassMain.Insert(tb_name, fields); return(res); }
public void ModifyCustomer(CustomerEN customer) { try { SessionInitializeTransaction(); CustomerEN customerEN = (CustomerEN)session.Load(typeof(CustomerEN), customer.Idnumber); customerEN.FirstName = customer.FirstName; customerEN.Email = customer.Email; customerEN.Password = customer.Password; customerEN.LastName = customer.LastName; customerEN.Address = customer.Address; customerEN.Telephone = customer.Telephone; customerEN.Zip = customer.Zip; session.Update(customerEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CustomerCAD.", ex); } finally { SessionClose(); } }
public void ModifyCustomer(string p_oid, string p_firstName, string p_email, string p_password, string p_lastName, string p_address, string p_telephone, string p_zip) { CustomerEN customerEN = null; //Initialized CustomerEN customerEN = new CustomerEN(); customerEN.Idnumber = p_oid; customerEN.FirstName = p_firstName; customerEN.Email = p_email; customerEN.Password = p_password; customerEN.LastName = p_lastName; customerEN.Address = p_address; customerEN.Telephone = p_telephone; customerEN.Zip = p_zip; //Call to CustomerCAD _ICustomerCAD.ModifyCustomer(customerEN); }
public bool Login(string p_oid, string pass) { /*PROTECTED REGION ID(P2GenNHibernate.CEN.Default__Customer_login) ENABLED START*/ CustomerEN cliente = _ICustomerCAD.GetCustomerByOID(p_oid); if (cliente.Password.Equals(pass)) { return(true); } else { return(false); } // Write here your custom code... throw new NotImplementedException("Method Login() not yet implemented."); /*PROTECTED REGION END*/ }
protected void btnSave_Click(object sender, EventArgs e) { ResultEN ResultENs = new ResultEN(); CustomerEN CustomerENs = new CustomerEN(); CustomerENs.C_ID = this.txtC_ID.Text; CustomerENs.Name = this.txtName.Text; CustomerENs.Tel = this.txtTel.Text; CustomerENs.Email = this.txtEmail.Text; CustomerENs.Fax = this.txtFax.Text; CustomerENs.Name_Company = this.txtCompany.Text; CustomerENs.Tel_Company = this.txtTel_Company.Text; CustomerENs.Address = this.txtAddress.Text; CustomerENs.Tax_Number = this.txtTax_Number.Text; if (Enum_Mode.Add.GetHashCode() == mode) { CustomerENs.CreatedBy = ""; CustomerENs.CreatedDate = DateTime.Now; ResultENs = ClassCustomer.Insert(CustomerENs); } else if (Enum_Mode.Edit.GetHashCode() == mode) { CustomerENs.UpdatedBy = ""; CustomerENs.UpdatedDate = DateTime.Now; ResultENs = ClassCustomer.Update(CustomerENs); } if (ResultENs != null && ResultENs.result) { LoadData(); } else { } }
private static List <ClassFieldValue> SetField(List <ClassFieldValue> fields, CustomerEN en) { //fields.Add(new ClassFieldValue("ID", en.ID)); fields.Add(new ClassFieldValue("C_ID", en.C_ID)); fields.Add(new ClassFieldValue("Name", en.Name)); fields.Add(new ClassFieldValue("Address", en.Address)); fields.Add(new ClassFieldValue("Email", en.Email)); fields.Add(new ClassFieldValue("EXT", en.EXT)); fields.Add(new ClassFieldValue("Fax", en.Fax)); fields.Add(new ClassFieldValue("Name_Company", en.Name_Company)); fields.Add(new ClassFieldValue("Tax_Number", en.Tax_Number)); fields.Add(new ClassFieldValue("Tel", en.Tel)); fields.Add(new ClassFieldValue("Tel_Company", en.Tel_Company)); //fields.Add(new ClassFieldValue("CreatedBy", en.CreatedBy)); //fields.Add(new ClassFieldValue("UpdatedBy", en.UpdatedBy)); //fields.Add(new ClassFieldValue("CreatedDate", Utilities.SetDBNull(en.CreatedDate))); //fields.Add(new ClassFieldValue("UpdatedDate", Utilities.SetDBNull(en.UpdatedDate))); return(fields); }