void GridOrderHistory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } AdsCom.OrderHistory oh = e.Row.DataItem as AdsCom.OrderHistory; Label lblBy = (Label)e.Row.FindControl("lblBy"); AdsCom.User usr = new AdsCom.User(); int str = oh.USER_ID; usr.Load(str); lblBy.Text = usr.RealName; Label lblOrderDate = (Label)e.Row.FindControl("lblOrderDate"); lblOrderDate.Text = oh.DATE.ToString("MM/dd/yyyy"); // oh.DATE.ToString(("MM/dd/yyyy")); Label lblAllocation = (Label)e.Row.FindControl("lblAllocation"); int str1 = oh.USERALLOCATED; usr.Load(str1); lblAllocation.Text = usr.RealName; Label lblOrderStatus = (Label)e.Row.FindControl("lblOrderStatus"); AdsCom.Status sts = new AdsCom.Status(); //int str3 = oh.ORDER_STATUS; sts.Load(oh.ORDER_ID); lblOrderStatus.Text = sts.ORDER_STATUS; }
void LoadByUserId(int UserId) { IList <Order> orders = new List <Order>(); orders = o.LoadByUserId(UserId); if (orders.Count == 0) { o = new Order(); if (Request["UserId"].ToString() != "0") { User u2 = new User(); u2.Load(Convert.ToInt32(Session["USER_ID"])); if (u2.STATUS_ID == 2) { IList <Order> orders1 = new List <Order>(); orders1 = AdsCom.Order.FindAll(); int defOrderId = 0; for (int i = 0; i < orders1.Count; i++) { if (orders1[i].USER_ID == 0) { defOrderId = orders1[i].Id; break; } } o.Load(defOrderId); if (o.STATUS_ID == 2) { // o.STATUS_ID = Convert.ToInt32(Request["StatusId"]); o.USER_ID = Convert.ToInt32(Session["USER_ID"]); o.Save(); AdsCom.OrderHistory oh1 = new AdsCom.OrderHistory(); oh1.ORDER_ID = o.ORDER_ID; oh1.USER_ID = Convert.ToInt32(Session["USER_ID"]); oh1.USERALLOCATED = Convert.ToInt32(Session["USER_ID"]); oh1.ORDER_STATUS = o.STATUS_ID; oh1.DATE = DateTime.Now; oh1.ADDITIONALINSTRUCTION = o.COMMENTS; oh1.Save(); Response.Redirect("ListQueue.aspx?UserId=" + o.USER_ID); } } } } grdAds.DataSource = orders; grdAds.DataBind(); lblNoofOrders.Text = orders.Count().ToString(); }
void grdAds_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Save") { o = new Order(); o.Load(Convert.ToInt32(e.CommandArgument)); o.STATUS_ID = Convert.ToInt32(Request["StatusId"]); o.USER_ID = Convert.ToInt32(Session["USER_ID"]); o.Save(); AdsCom.OrderHistory oh = new AdsCom.OrderHistory(); oh.ORDER_ID = o.ORDER_ID; oh.USER_ID = Convert.ToInt32(Session["USER_ID"]); oh.USERALLOCATED = Convert.ToInt32(Session["USER_ID"]); oh.ORDER_STATUS = o.STATUS_ID; oh.DATE = DateTime.Now; //string strAction = string.Empty; //if (o.ACTION == 1) // strAction = "Completed"; //else if (o.ACTION == 2) // strAction = "Hold"; //else if (o.ACTION == 3) // strAction = "Return"; // strAction + " (" + o.ALBUM_RATING + ") " + oh.ADDITIONALINSTRUCTION = o.COMMENTS; oh.Save(); AdsCom.UserHistory uh = new AdsCom.UserHistory(); uh.Order_Id = o.ORDER_ID; uh.User_Id = Convert.ToInt32(Session["USER_ID"]); uh.Allocated_Date = DateTime.Now; uh.Submitted_Date = DateTime.MaxValue; uh.Totaltime = DateTime.MaxValue; uh.Save(); Response.Redirect("ListQueue.aspx?Userid=" + o.USER_ID); } }
protected void btnSubmitAdmin_Click(object sender, EventArgs e) { int insid = 0; if (!Page.IsValid) { return; } if (!String.IsNullOrEmpty(txtInstructions.Text)) { o = new Order(); Instructions ins = new Instructions(); ins.ADDITIONALINSTRUCTION = txtInstructions.Text; ins.USER_ID = Convert.ToInt32(Session["USER_ID"]); if (Request["AID"] != null) { o.Load(Convert.ToInt32(Request["AID"])); } ins.ORDER_ID = o.ORDER_ID; ins.Date = DateTime.Now; ins.Save(); string str2 = "select max(INSTRUCTION_ID) from INSTRUCTIONS "; com = new SqlCommand(str2, con); SqlDataAdapter adp = new SqlDataAdapter(com); DataSet ds = new DataSet(); adp.Fill(ds); con.Open(); SqlDataReader reader = com.ExecuteReader(CommandBehavior.CloseConnection); if (reader.Read()) { insid = Convert.ToInt32(reader[0]); } con.Close(); } if (Request["AID"] != null) { o.Load(Convert.ToInt32(Request["AID"])); } o.ORDER_ID = Convert.ToInt16(lblOrderId.Text); o.EVENT_ID = Convert.ToInt16(txtEventId.Text); o.GRAPHER_ID = lblStudioId.Text; o.FOLDER_NAME = txtFolderName.Text; o.PAGES = Convert.ToInt16(txtPages.Text); o.ALBUM_TYPE = Convert.ToInt16(drpBind.SelectedValue); o.ALBUM_STYLE = Convert.ToInt16(drpStyle.SelectedValue); o.ALBUM_SIZE = Convert.ToInt16(drpSize.SelectedValue); o.USER_ID = Convert.ToInt16(drpUserId.SelectedValue); o.SPECIAL_INSTRUCTIONS = lblInstruction.Text; o.ORIGINAL_ALBUM_ID = Convert.ToInt16(lblOriginalId.Text); o.IMAGE_LIST = lblImageList.Text; if (!String.IsNullOrEmpty(txtAlbumId.Text)) { o.ALBUM_ID = Convert.ToInt16(txtAlbumId.Text); } else { o.ALBUM_ID = 0; } o.ALBUM_NAME = txtAlbumName.Text; if (!String.IsNullOrEmpty(txtImages.Text)) { o.IMAGES = Convert.ToInt32(txtImages.Text); } else { o.IMAGES = 0; } o.ACTION = Convert.ToInt16(drpSubmitAs.SelectedValue); //if (!String.IsNullOrEmpty(drpRating.SelectedValue)) o.ALBUM_RATING = Convert.ToInt16(drpRating.SelectedValue); AdsCom.UserHistory uh = new AdsCom.UserHistory(); IList <AdsCom.UserHistory> userhis = new List <AdsCom.UserHistory>(); userhis = AdsCom.UserHistory.LoadByOrderId(o.ORDER_ID); if (!String.IsNullOrEmpty(txtQcComment.Text)) { o.COMMENTS = txtQcComment.Text; } o.PRIORITY = Convert.ToInt16(rbPriortiy.SelectedValue); o.STATUS_ID = Convert.ToInt16(drpCurrentStatusId.SelectedValue); if (!String.IsNullOrEmpty(txtInstructions.Text)) { o.INSTRUCTION_ID = insid; } o.Save(); AdsCom.Priority pr = new AdsCom.Priority(); Regex rx = new Regex("<[^>]*>"); string str = rx.Replace(rbPriortiy.SelectedItem.Text, ""); if (o.PRIORITY > 1) { pr.Priority_Id = o.PRIORITY; pr.Priority_Name = str; pr.Save(); } AdsCom.OrderHistory oh = new AdsCom.OrderHistory(); oh.ORDER_ID = o.ORDER_ID; oh.USER_ID = Convert.ToInt32(Session["USER_ID"]); oh.USERALLOCATED = Convert.ToInt16(drpUserId.SelectedValue); oh.ORDER_STATUS = Convert.ToInt16(drpSubmitTo.SelectedValue); oh.DATE = DateTime.Now; string strAction = string.Empty; if (o.ACTION == 1) { strAction = "Completed"; } else if (o.ACTION == 2) { strAction = "Hold"; } else if (o.ACTION == 3) { strAction = "Return"; } oh.ADDITIONALINSTRUCTION = o.COMMENTS; oh.Save(); if (!String.IsNullOrEmpty(txtInstructions.Text)) { oh.ORDER_ID = o.ORDER_ID; oh.USER_ID = o.USER_ID; oh.DATE = DateTime.Now; oh.ADDITIONALINSTRUCTION = txtInstructions.Text; oh.Save(); } Response.Redirect("ShowOrder.aspx?AID=" + o.Id); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } o = new Order(); if (Request["AID"] != null) { o.Load(Convert.ToInt32(Request["AID"])); } // Session["ORDER_ID"] = o.ORDER_ID; o.ORDER_ID = Convert.ToInt16(lblOrderId.Text); o.EVENT_ID = Convert.ToInt16(txtEventId.Text); o.GRAPHER_ID = lblStudioId.Text; o.FOLDER_NAME = txtFolderName.Text; o.PAGES = Convert.ToInt16(txtPages.Text); o.ALBUM_TYPE = Convert.ToInt16(drpBind.SelectedValue); o.ALBUM_STYLE = Convert.ToInt16(drpStyle.SelectedValue); o.ALBUM_SIZE = Convert.ToInt16(drpSize.SelectedValue); o.USER_ID = Convert.ToInt16(drpUserId.SelectedValue); o.SPECIAL_INSTRUCTIONS = lblInstruction.Text; o.ORIGINAL_ALBUM_ID = Convert.ToInt16(lblOriginalId.Text); o.PRIORITY = Convert.ToInt16(rbPriortiy.SelectedValue); o.IMAGE_LIST = lblImageList.Text; o.ALBUM_ID = Convert.ToInt16(txtAlbumId.Text); o.ALBUM_NAME = txtAlbumName.Text; o.IMAGES = Convert.ToInt16(txtImages.Text); o.ACTION = Convert.ToInt16(drpSubmitAs.SelectedValue); // if (!String.IsNullOrEmpty(drpRating.SelectedValue)) o.ALBUM_RATING = Convert.ToInt16(drpRating.SelectedValue); o.COMMENTS = txtQcComment.Text; if (!String.IsNullOrEmpty(txtInstructions.Text)) { o.INSTRUCTION_ID = Convert.ToInt16(lblNewInstruction.Text); } o.STATUS_ID = Convert.ToInt16(drpSubmitTo.SelectedValue); o.USER_ID = 0; o.Save(); Change ch = new Change(); Change c = ch.LoadByOrderId(o.ORDER_ID); c.Order_Id = o.ORDER_ID; User usr = new User(); int str = Convert.ToInt32(Session["USER_ID"]); usr.Load(str); if (c.Id != 0) { Change ch2 = new Change(); ch2.Load(c.Id); if (o.STATUS_ID == 2) { ch2.Design_By_Id = Convert.ToInt32(Session["USER_ID"]); ch2.Design_By_Name = usr.RealName; } else if (o.STATUS_ID == 3) { ch2.Qa_By_Id = Convert.ToInt32(Session["USER_ID"]); ch2.Qa_By_Name = usr.RealName; } ch2.Save(); } else { if (o.STATUS_ID == 2) { c.Design_By_Id = Convert.ToInt32(Session["USER_ID"]); c.Design_By_Name = usr.RealName; } else if (o.STATUS_ID == 3) { c.Qa_By_Id = Convert.ToInt32(Session["USER_ID"]); c.Qa_By_Name = usr.RealName; } c.Save(); } AdsCom.OrderHistory oh = new AdsCom.OrderHistory(); oh.ORDER_ID = o.ORDER_ID; oh.USER_ID = Convert.ToInt32(Session["USER_ID"]); oh.USERALLOCATED = Convert.ToInt16(drpUserId.SelectedValue); oh.ORDER_STATUS = Convert.ToInt16(drpSubmitTo.SelectedValue); oh.DATE = DateTime.Now; string strAction = string.Empty; if (o.ACTION == 1) { strAction = "Completed"; } else if (o.ACTION == 2) { strAction = "Hold"; } else if (o.ACTION == 3) { strAction = "Return"; } oh.ADDITIONALINSTRUCTION = strAction + " (" + o.ALBUM_RATING + ") " + o.COMMENTS; oh.Save(); //Regex rx = new Regex("<[^>]*>"); //string str = rx.Replace(rbPriortiy.SelectedItem.Text, ""); //o.PRIORITY = Convert.ToInt16(rbPriortiy.SelectedValue); AdsCom.UserHistory uh = new AdsCom.UserHistory(); int str1 = Convert.ToInt32(Session["USER_ID"]); uh.Load(str1); uh.Order_Id = o.ORDER_ID; uh.User_Id = Convert.ToInt32(Session["USER_ID"]); string strAction1 = string.Empty; if (o.ACTION == 1) { strAction1 = "Completed"; } else if (o.ACTION == 2) { strAction1 = "Hold"; } else if (o.ACTION == 3) { strAction1 = "Return"; } uh.Comments = strAction1 + " (" + o.ALBUM_RATING + ") " + o.COMMENTS; uh.Status_Id = Convert.ToInt16(drpSubmitTo.SelectedValue); uh.Allocated_Date = DateTime.Now; uh.Submitted_Date = DateTime.Now; uh.Images = o.IMAGES; uh.Pages = o.PAGES; uh.Totaltime = DateTime.Now; uh.Save(); Response.Redirect("ListQueue.aspx?UserId=" + Session["USER_ID"]); }