protected void LinkButton5_Click(object sender, EventArgs e) { ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(Request.QueryString["id"])); String images = p1.DesignFiles; String[] arr = images.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries); p1.DesignFiles = arr[0] + "#,#"; p1.DesignFiles += arr[1] + "#,#"; p1.DesignFiles += arr[2] + "#,#"; p1.DesignFiles += arr[3] + "#,#"; pl.Update(p1); Response.Redirect("NewProduct.aspx?id=" + Request.QueryString["id"]); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { EmployeeLogic el = new EmployeeLogic(); Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"])); if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("EMPLOYEE") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE"))) { if(e.CommandName.Equals("Product Designed")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Product Designed"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Product Designed"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("Product Sent for client design approval")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Product Sent for client design approval"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Product Sent for client design approval"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("Design approved by client")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Design approved by client"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Design approved by client"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("Trial product prepared")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Trial product prepared"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Trial product prepared"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("Trial product sent for client approval")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Trial product sent for client approval"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Trial product sent for client approval"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("Trial product approved by client")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "Trial product approved by client"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "Trial product approved by client"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); }else if(e.CommandName.Equals("product approved")){ ProductLogic pl = new ProductLogic(); Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument)); p1.Status = "product approved"; pl.Update(p1); DataTable dt = pl.SelectAllJoined(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = p1.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = "product approved"; t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text; tl.Insert(t1); } } else { Response.Redirect("Access.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { if (Convert.ToInt32(Request.QueryString["ID"]) > 0) { //edit mode ProductLogic PL = new ProductLogic(); Product objPro = PL.SelectByProductID(Convert.ToInt32(Request.QueryString["ID"])); objPro.Name = TextBox1.Text; if (objPro.Status.Equals(DropDownList3.SelectedItem.Text)) { objPro.Status = DropDownList3.SelectedItem.Text; } else { TransitionLogic tl = new TransitionLogic(); Transition t1 = new Transition(); t1.KeyID = objPro.ProductID; t1.KeyType = "Prod"; t1.TranDate = DateTime.Now; t1.NewStatus = DropDownList3.SelectedItem.Text; t1.Remarks = ""; tl.Insert(t1); objPro.Status = DropDownList3.SelectedItem.Text; } objPro.Description = TextArea1.Text; objPro.Size = TextBox4.Text; objPro.Colors = TextBox5.Text; objPro.Type = DropDownList1.SelectedItem.Text; objPro.CustomerID = Convert.ToInt32(DropDownList2.SelectedItem.Value); DateTime d1 = new DateTime(); if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { objPro.CreateDate = DateTime.Now; } if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString())) { objPro.CreateDate = DateTime.Now; } else { objPro.CreateDate = d1; } String path = objPro.DesignFiles; string ticks = DateTime.Now.Ticks.ToString(); if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName)); path += "Images/" + ticks + FileUpload1.FileName + "#,#"; } if (FileUpload2.HasFile) { FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName)); path += "Images/" + ticks + FileUpload2.FileName + "#,#"; } if (FileUpload3.HasFile) { FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName)); path += "Images/" + ticks + FileUpload3.FileName + "#,#"; } if (FileUpload4.HasFile) { FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName)); path += "Images/" + ticks + FileUpload4.FileName + "#,#"; } if (FileUpload5.HasFile) { FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName)); path += "Images/" + ticks + FileUpload5.FileName + "#,#"; } objPro.DesignFiles = path; objPro.ProductID = Convert.ToInt32(Request.QueryString["id"]); PL.Update(objPro); Response.Redirect("ProdList.aspx"); } else { // insert mode Product objPro = new Product(); objPro.Name = TextBox1.Text; objPro.Status =DropDownList3.SelectedItem.Text; objPro.Description = TextArea1.Text; objPro.Size = TextBox4.Text; objPro.Colors = TextBox5.Text; objPro.Type = DropDownList1.Text; objPro.CustomerID = Convert.ToInt32(DropDownList2.SelectedItem.Value); DateTime d1 = new DateTime(); if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { objPro.CreateDate = DateTime.Now; } if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString())) { objPro.CreateDate = DateTime.Now; } else { objPro.CreateDate = d1; } String path = ""; string ticks = DateTime.Now.Ticks.ToString(); if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName)); path += "Images/" + ticks + FileUpload1.FileName + "#,#"; } if (FileUpload2.HasFile) { FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName)); path += "Images/" + ticks + FileUpload2.FileName + "#,#"; } if (FileUpload3.HasFile) { FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName)); path += "Images/" + ticks + FileUpload3.FileName + "#,#"; } if (FileUpload4.HasFile) { FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName)); path += "Images/" + ticks + FileUpload4.FileName + "#,#"; } if (FileUpload5.HasFile) { FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName)); path += "Images/" + ticks + FileUpload5.FileName + "#,#"; } objPro.DesignFiles = path; ProductLogic PL = new ProductLogic(); PL.Insert(objPro); Response.Redirect("ProdList.aspx"); } }