//protected void btnClear_Click(object sender, EventArgs e) //{ // txtCardNo.Text = ""; // //txtSignature.Text = ""; // txtCustomerName.Text = ""; // //ddlReference.SelectedIndex = 0; // txtAddress.Text = ""; // txtContactNo.Text = ""; // txtPhone.Text = ""; // txtDiscountPersent.Text = ""; // txtRemark.Text = ""; // txtBranchNo.Text = ""; // txtCompanyName.Text = ""; // txtOfficeAddress.Text = ""; // txtdesignation.Text = ""; // txtOccupation.Text = ""; // //txtAddedBy.Text = ""; // //txtUpdatedBy.Text = ""; // //txtUpdatedDate.Text = ""; // //ddlRowSatatus.SelectedIndex = 0; //} private void showPos_CustomerData() { Pos_Customer pos_Customer = new Pos_Customer(); pos_Customer = Pos_CustomerManager.GetPos_CustomerByID(Int32.Parse(Request.QueryString["pos_CustomerID"])); ddlBranch.SelectedValue = pos_Customer.ExtraFiled1; txtCustomerName.Text = pos_Customer.CustomerName; txtAddress.Text = pos_Customer.Address; txtCompanyName.Text = pos_Customer.ExtraFiled2; txtOfficeAddress.Text = pos_Customer.ExtraFiled3; txtPhone.Text = pos_Customer.Phone; txtdesignation.Text = pos_Customer.ExtraFiled4; txtOccupation.Text = pos_Customer.ExtraFiled5; txtDateofBirth.Text = pos_Customer.DateofBirth.ToString("dd MMM yyyy"); txtContactNo.Text = pos_Customer.Mobile; txtApplicationDate.Text = pos_Customer.ApplicationDate.ToString("dd MMM yyyy"); txtCardNo.Text = pos_Customer.CardNo; txtCardIssueDate.Text = pos_Customer.CardIssueDate.ToString("dd MMM yyyy"); txtExpireDate.Text = pos_Customer.ExpireDate.ToString("dd MMM yyyy"); ddlCardType.SelectedValue = pos_Customer.CardType; txtDiscountPersent.Text = pos_Customer.DiscountPersent.ToString("0.00"); //txtSignature.Text = pos_Customer.Signature; txtApprovedBy.Text = pos_Customer.ApprovedBy; txtRemark.Text = pos_Customer.Note; ddlReference.SelectedValue = pos_Customer.ReferenceID.ToString(); //ddlReference.SelectedValue = pos_Customer.ReferenceID.ToString(); //ddlRowSatatus.SelectedValue = pos_Customer.RowSatatusID.ToString(); }
public static Pos_Customer GetPos_CustomerByID(int id) { Pos_Customer pos_Customer = new Pos_Customer(); SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); pos_Customer = sqlPos_CustomerProvider.GetPos_CustomerByID(id); return pos_Customer; }
public static Pos_Customer GetPos_CustomerByID(int id) { Pos_Customer pos_Customer = new Pos_Customer(); SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); pos_Customer = sqlPos_CustomerProvider.GetPos_CustomerByID(id); return(pos_Customer); }
public Pos_Customer GetPos_CustomerFromReader(IDataReader reader) { try { Pos_Customer pos_Customer = new Pos_Customer ( (int)reader["Pos_CustomerID"], reader["CardNo"].ToString(), reader["Signature"].ToString(), reader["CustomerName"].ToString(), (int)reader["ReferenceID"], reader["Address"].ToString(), reader["Mobile"].ToString(), reader["Phone"].ToString(), (decimal)reader["DiscountPersent"], reader["Note"].ToString(), reader["ExtraFiled1"].ToString(), reader["ExtraFiled2"].ToString(), reader["ExtraFiled3"].ToString(), reader["ExtraFiled4"].ToString(), reader["ExtraFiled5"].ToString(), (int)reader["AddedBy"], (DateTime)reader["AddedDate"], (int)reader["UpdatedBy"], (DateTime)reader["UpdatedDate"], (int)reader["RowSatatusID"], (DateTime)reader["DateofBirth"], (DateTime)reader["ApplicationDate"], (DateTime)reader["CardIssueDate"], (DateTime)reader["ExpireDate"], reader["CardType"].ToString(), reader["ApprovedBy"].ToString() ); return(pos_Customer); } catch (Exception ex) { return(null); } }
public bool UpdatePos_Customer(Pos_Customer pos_Customer) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("GP_UpdatePos_Customer", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Pos_CustomerID", SqlDbType.Int).Value = pos_Customer.Pos_CustomerID; cmd.Parameters.Add("@CardNo", SqlDbType.VarChar).Value = pos_Customer.CardNo; cmd.Parameters.Add("@Signature", SqlDbType.NVarChar).Value = pos_Customer.Signature; cmd.Parameters.Add("@CustomerName", SqlDbType.VarChar).Value = pos_Customer.CustomerName; cmd.Parameters.Add("@ReferenceID", SqlDbType.Int).Value = pos_Customer.ReferenceID; cmd.Parameters.Add("@Address", SqlDbType.VarChar).Value = pos_Customer.Address; cmd.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = pos_Customer.Mobile; cmd.Parameters.Add("@Phone", SqlDbType.VarChar).Value = pos_Customer.Phone; cmd.Parameters.Add("@DiscountPersent", SqlDbType.Decimal).Value = pos_Customer.DiscountPersent; cmd.Parameters.Add("@Note", SqlDbType.VarChar).Value = pos_Customer.Note; cmd.Parameters.Add("@ExtraFiled1", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled1; cmd.Parameters.Add("@ExtraFiled2", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled2; cmd.Parameters.Add("@ExtraFiled3", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled3; cmd.Parameters.Add("@ExtraFiled4", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled4; cmd.Parameters.Add("@ExtraFiled5", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled5; cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = pos_Customer.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = pos_Customer.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = pos_Customer.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_Customer.UpdatedDate; cmd.Parameters.Add("@RowSatatusID", SqlDbType.Int).Value = pos_Customer.RowSatatusID; cmd.Parameters.Add("@DateofBirth", SqlDbType.DateTime).Value = pos_Customer.DateofBirth; cmd.Parameters.Add("@ApplicationDate", SqlDbType.DateTime).Value = pos_Customer.ApplicationDate; cmd.Parameters.Add("@CardIssueDate", SqlDbType.DateTime).Value = pos_Customer.CardIssueDate; cmd.Parameters.Add("@ExpireDate", SqlDbType.DateTime).Value = pos_Customer.ExpireDate; cmd.Parameters.Add("@CardType", SqlDbType.NVarChar).Value = pos_Customer.CardType; cmd.Parameters.Add("@ApprovedBy", SqlDbType.NVarChar).Value = pos_Customer.ApprovedBy; connection.Open(); int result = cmd.ExecuteNonQuery(); return(result == 1); } }
public static bool UpdatePos_Customer(Pos_Customer pos_Customer) { SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); return(sqlPos_CustomerProvider.UpdatePos_Customer(pos_Customer)); }
public static int InsertPos_Customer(Pos_Customer pos_Customer) { SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); return(sqlPos_CustomerProvider.InsertPos_Customer(pos_Customer)); }
protected void btnUpdate_Click(object sender, EventArgs e) { Pos_Customer pos_Customer = new Pos_Customer(); pos_Customer = Pos_CustomerManager.GetPos_CustomerByID(Int32.Parse(Request.QueryString["pos_CustomerID"])); Pos_Customer tempPos_Customer = new Pos_Customer(); tempPos_Customer.Pos_CustomerID = pos_Customer.Pos_CustomerID; tempPos_Customer.ExtraFiled1 = ddlBranch.SelectedValue; tempPos_Customer.CustomerName = txtCustomerName.Text; tempPos_Customer.Address = txtAddress.Text; tempPos_Customer.ExtraFiled2 = txtCompanyName.Text; tempPos_Customer.ExtraFiled3 = txtOfficeAddress.Text; tempPos_Customer.Phone = txtPhone.Text; tempPos_Customer.ExtraFiled4 = txtdesignation.Text; tempPos_Customer.ExtraFiled5 = txtOccupation.Text; tempPos_Customer.DateofBirth = Convert.ToDateTime(txtDateofBirth.Text); tempPos_Customer.Mobile = txtContactNo.Text; tempPos_Customer.ApplicationDate = Convert.ToDateTime(txtApplicationDate.Text); tempPos_Customer.CardNo = txtCardNo.Text; tempPos_Customer.CardIssueDate = Convert.ToDateTime(txtCardIssueDate.Text); tempPos_Customer.ExpireDate = Convert.ToDateTime(txtExpireDate.Text); tempPos_Customer.CardType = ddlCardType.SelectedValue; //tempPos_Customer.Signature = txtSignature.Text; if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0) { try { string dirUrl = "~/Upload"; string dirPath = Server.MapPath(dirUrl); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string fileName = Path.GetFileName(uplFile.PostedFile.FileName); string fileUrl = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName); string filePath = Server.MapPath(fileUrl); uplFile.PostedFile.SaveAs(filePath); tempPos_Customer.Signature = dirUrl + "/" + fileName; } catch (Exception ex) { ex.Message.ToString(); } } else { tempPos_Customer.Signature = pos_Customer.Signature; } tempPos_Customer.ApprovedBy = txtApprovedBy.Text; tempPos_Customer.Note = txtRemark.Text; tempPos_Customer.ReferenceID = Convert.ToInt32(ddlReference.SelectedValue); tempPos_Customer.DiscountPersent = Decimal.Parse(txtDiscountPersent.Text); tempPos_Customer.AddedBy = 1; tempPos_Customer.AddedDate = DateTime.Now; tempPos_Customer.UpdatedBy = 1; tempPos_Customer.UpdatedDate = DateTime.Now; tempPos_Customer.RowSatatusID = 1; bool result = Pos_CustomerManager.UpdatePos_Customer(tempPos_Customer); Response.Redirect("AdminPos_CustomerDisplay.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { Pos_Customer pos_Customer = new Pos_Customer(); pos_Customer.ExtraFiled1 = ddlBranch.SelectedValue; pos_Customer.CustomerName = txtCustomerName.Text; pos_Customer.Address = txtAddress.Text; pos_Customer.ExtraFiled2 = txtCompanyName.Text; pos_Customer.ExtraFiled3 = txtOfficeAddress.Text; pos_Customer.Phone = txtPhone.Text; pos_Customer.ExtraFiled4 = txtdesignation.Text; pos_Customer.ExtraFiled5 = txtOccupation.Text; pos_Customer.DateofBirth = Convert.ToDateTime(txtDateofBirth.Text); pos_Customer.Mobile = txtContactNo.Text; pos_Customer.ApplicationDate = Convert.ToDateTime(txtApplicationDate.Text); pos_Customer.CardNo = txtCardNo.Text; pos_Customer.CardIssueDate = Convert.ToDateTime(txtCardIssueDate.Text); pos_Customer.ExpireDate = Convert.ToDateTime(txtExpireDate.Text); pos_Customer.CardType = ddlCardType.SelectedValue; pos_Customer.DiscountPersent = Decimal.Parse(txtDiscountPersent.Text); //pos_Customer.Signature = txtSignature.Text; if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0) { try { string dirUrl = "~/Upload"; string dirPath = Server.MapPath(dirUrl); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string fileName = Path.GetFileName(uplFile.PostedFile.FileName); string fileUrl = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName); string filePath = Server.MapPath(fileUrl); uplFile.PostedFile.SaveAs(filePath); pos_Customer.Signature = dirUrl + "/" + fileName; } catch (Exception ex) { ex.Message.ToString(); } } else { pos_Customer.Signature = "~/Upload/NoImage.jpg"; } pos_Customer.ApprovedBy = txtApprovedBy.Text; pos_Customer.Note = txtRemark.Text; pos_Customer.ReferenceID = Convert.ToInt32(ddlReference); pos_Customer.AddedBy = 1; pos_Customer.AddedDate = DateTime.Now; pos_Customer.UpdatedBy = 1; pos_Customer.UpdatedDate = DateTime.Now; pos_Customer.RowSatatusID = 1; int resutl = Pos_CustomerManager.InsertPos_Customer(pos_Customer); Response.Redirect("AdminPos_CustomerDisplay.aspx"); /* * INSERT INTO [GentleParkHO].[dbo].[Pos_Customer] * ([CardNo] * ,[Signature] * ,[CustomerName] * ,[ReferenceID] * ,[Address] * ,[Mobile] * ,[Phone] * ,[DiscountPersent] * ,[Note] * ,[ExtraFiled1] * ,[ExtraFiled2] * ,[ExtraFiled3] * ,[ExtraFiled4] * ,[ExtraFiled5] * ,[AddedBy] * ,[AddedDate] * ,[UpdatedBy] * ,[UpdatedDate] * ,[RowSatatusID] * ,[DateofBirth] * ,[ApplicationDate] * ,[CardIssueDate] * ,[ExpireDate] * ,[CardType] * ,[ApprovedBy]) * Select CardNo * ,'' * ,CustomerName * ,0 * ,[Address] * ,Mobile * ,Phone * ,DiscountPersent * ,''--<Note, varchar(50),> * ,''--<ExtraFiled1, nvarchar(256),> * ,''--<ExtraFiled2, nvarchar(256),> * ,''--<ExtraFiled3, nvarchar(256),> * ,''--<ExtraFiled4, nvarchar(256),> * ,''--<ExtraFiled5, nvarchar(256),> * ,45--<AddedBy, int,> * ,GETDATE()--<AddedDate, datetime,> * ,45--<UpdatedBy, int,> * ,GETDATE()--<UpdatedDate, datetime,> * ,1--<RowSatatusID, int,> * ,GETDATE()--<DateofBirth, datetime,> * ,GETDATE()--<ApplicationDate, datetime,> * ,GETDATE()--<CardIssueDate, datetime,> * ,GETDATE()--<ExpireDate, datetime,> * ,''--<CardType, nvarchar(50),> * ,''--<ApprovedBy, nvarchar(256),>) * From Pos_Customer_tmp * * */ }
public Pos_Customer GetPos_CustomerFromReader(IDataReader reader) { try { Pos_Customer pos_Customer = new Pos_Customer ( (int)reader["Pos_CustomerID"], reader["CardNo"].ToString(), reader["Signature"].ToString(), reader["CustomerName"].ToString(), (int)reader["ReferenceID"], reader["Address"].ToString(), reader["Mobile"].ToString(), reader["Phone"].ToString(), (decimal)reader["DiscountPersent"], reader["Note"].ToString(), reader["ExtraFiled1"].ToString(), reader["ExtraFiled2"].ToString(), reader["ExtraFiled3"].ToString(), reader["ExtraFiled4"].ToString(), reader["ExtraFiled5"].ToString(), (int)reader["AddedBy"], (DateTime)reader["AddedDate"], (int)reader["UpdatedBy"], (DateTime)reader["UpdatedDate"], (int)reader["RowSatatusID"], (DateTime)reader["DateofBirth"], (DateTime)reader["ApplicationDate"], (DateTime)reader["CardIssueDate"], (DateTime)reader["ExpireDate"], reader["CardType"].ToString(), reader["ApprovedBy"].ToString() ); return pos_Customer; } catch(Exception ex) { return null; } }
public bool UpdatePos_Customer(Pos_Customer pos_Customer) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("GP_UpdatePos_Customer", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Pos_CustomerID", SqlDbType.Int).Value = pos_Customer.Pos_CustomerID; cmd.Parameters.Add("@CardNo", SqlDbType.VarChar).Value = pos_Customer.CardNo; cmd.Parameters.Add("@Signature", SqlDbType.NVarChar).Value = pos_Customer.Signature; cmd.Parameters.Add("@CustomerName", SqlDbType.VarChar).Value = pos_Customer.CustomerName; cmd.Parameters.Add("@ReferenceID", SqlDbType.Int).Value = pos_Customer.ReferenceID; cmd.Parameters.Add("@Address", SqlDbType.VarChar).Value = pos_Customer.Address; cmd.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = pos_Customer.Mobile; cmd.Parameters.Add("@Phone", SqlDbType.VarChar).Value = pos_Customer.Phone; cmd.Parameters.Add("@DiscountPersent", SqlDbType.Decimal).Value = pos_Customer.DiscountPersent; cmd.Parameters.Add("@Note", SqlDbType.VarChar).Value = pos_Customer.Note; cmd.Parameters.Add("@ExtraFiled1", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled1; cmd.Parameters.Add("@ExtraFiled2", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled2; cmd.Parameters.Add("@ExtraFiled3", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled3; cmd.Parameters.Add("@ExtraFiled4", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled4; cmd.Parameters.Add("@ExtraFiled5", SqlDbType.NVarChar).Value = pos_Customer.ExtraFiled5; cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = pos_Customer.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = pos_Customer.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = pos_Customer.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_Customer.UpdatedDate; cmd.Parameters.Add("@RowSatatusID", SqlDbType.Int).Value = pos_Customer.RowSatatusID; cmd.Parameters.Add("@DateofBirth", SqlDbType.DateTime).Value = pos_Customer.DateofBirth; cmd.Parameters.Add("@ApplicationDate", SqlDbType.DateTime).Value = pos_Customer.ApplicationDate; cmd.Parameters.Add("@CardIssueDate", SqlDbType.DateTime).Value = pos_Customer.CardIssueDate; cmd.Parameters.Add("@ExpireDate", SqlDbType.DateTime).Value = pos_Customer.ExpireDate; cmd.Parameters.Add("@CardType", SqlDbType.NVarChar).Value = pos_Customer.CardType; cmd.Parameters.Add("@ApprovedBy", SqlDbType.NVarChar).Value = pos_Customer.ApprovedBy; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public static bool UpdatePos_Customer(Pos_Customer pos_Customer) { SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); return sqlPos_CustomerProvider.UpdatePos_Customer(pos_Customer); }
public static int InsertPos_Customer(Pos_Customer pos_Customer) { SqlPos_CustomerProvider sqlPos_CustomerProvider = new SqlPos_CustomerProvider(); return sqlPos_CustomerProvider.InsertPos_Customer(pos_Customer); }