protected void Page_Load(object sender, EventArgs e) { depName = Request.QueryString["DepartmentName"].ToString(); if (!IsPostBack) { imgCover.ImageUrl = "~/Signature/Default.png"; DropDownList2.DataTextFormatString = "{0:dd-MM-yyyy}"; ddate = DeliveryDate.getDeliveryDate(); rdlistValue = depName; Label1.Text = depName + "Disbursement Items"; bindData(); } if (GridView1.Rows.Count == 0) { imgCover.Visible = false; FileUploadImg.Visible = false; btnUpload.Visible = false; lblsign.Visible = false; btnsubmit.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { String supplierID = Request.QueryString["supplier_id"]; item_number = Request.QueryString["item_Number"]; orderid = Request.QueryString["order_id"]; string sts = Request.QueryString["status"]; ord = Convert.ToInt32(orderid); Supplier s = model.Suppliers.Where(x => x.Supplier_ID == supplierID).First(); lblsupname.Text = s.Supplier_Name; lblfax.Text = s.Fax_Number.ToString(); lblcontanct.Text = s.Contact_Number.ToString(); lblorderID.Text = orderid; lblstatus.Text = sts; var podetail = model.Purchase_Order_Details.Where(x => x.Order_ID == ord && x.Item_Number == item_number).Select(x => x.Quantity).First(); lblqty.Text = podetail.ToString(); iteminfo = model.Stationery_Catalogue.Where(x => x.Item_Number == item_number).First(); lblcategory.Text = iteminfo.Category; lbldescription.Text = iteminfo.Description; lblunitprice.Text = iteminfo.Price.ToString(); int qty = Convert.ToInt32(iteminfo.Reorder_Quantity); Double unitprice = ((double)podetail / (double)qty); Double total = (Double)((Double)iteminfo.Price * (double)unitprice); lbltotal.Text = total.ToString(); DateTime today = DateTime.Today; if (today.DayOfWeek == DayOfWeek.Monday) { lbldelivery.Text = today.ToString(); } else { int daysmonday = ((int)DayOfWeek.Monday - (int)today.DayOfWeek + 7) % 7; DateTime monday = today.AddDays(daysmonday); lbldelivery.Text = DeliveryDate.getDeliveryDate(); /*monday.ToString();*/ } orderdetail = model.Purchase_Order_Details.Where(x => x.Order_ID == ord && x.Item_Number == item_number).First(); string status = orderdetail.Status; if (status.Equals("Purchased") || status.Equals("Forwarded")) { btnSendInvoice.Visible = false; btnAddtoStock.Visible = false; } orderdetail = model.Purchase_Order_Details.Where(x => x.Order_ID == ord && x.Item_Number == item_number).First(); Random r = new Random(); int invoicenp = r.Next(1000000, 9999999); lblInvoice.Text = invoicenp.ToString(); }
protected void btnUpload_Click(object sender, EventArgs e) { string directory = Server.MapPath(null); if (!Directory.Exists(directory + "\\Signature")) { Directory.CreateDirectory(directory + "\\Signature"); } else { } if (FileUploadImg.HasFile) { ext = System.IO.Path.GetExtension(FileUploadImg.FileName); if (ext.ToLower() != ".jpg" && ext.ToLower() != ".png" && ext.ToLower() != ".gif" && ext.ToLower() != ".jpeg") { lbUploadMessage.Text = "A valid image file is required!"; } else { try { //string filename = Path.GetFileName(FileUploadImg.FileName); lblext.Text = ext; string filename = RadioButtonList1.SelectedValue + "(" + DeliveryDate.getDeliveryDate() + ")"; FileUploadImg.SaveAs(Server.MapPath("~/") + "\\Signature\\" + filename + ext); imgCover.ImageUrl = "~/Signature/" + filename + ext; lbUploadMessage.Text = "Upload status: File uploaded!"; } catch (Exception ex) { lbUploadMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } } else { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rdlistValue = "'FASS'"; RadioButtonList1.SelectedIndex = 0; Label1.Text = " Arts Department Disbursement Items"; Label2.Text = DeliveryDate.getDeliveryDate(); Label1.Text = " ARTS DEPARTMENT'S DISBURSEMENT ITEMS "; bindData(); } if (GridView1.Rows.Count == 0) { imgCover.Visible = false; FileUploadImg.Visible = false; btnUpload.Visible = false; lblsign.Visible = false; btnsubmit.Enabled = false; } }
protected void Button2_Click(object sender, EventArgs e) { string itemId, departmentId, reason; DateTime deliveryDate; int iou, reqQty, dQty, retrunQty; try { if (lblext.Text.ToLower() != ".jpg" && lblext.Text.ToLower() != ".png" && lblext.Text.ToLower() != ".gif" && lblext.Text.ToLower() != ".jpeg") { lbUploadMessage.Text = "A valid image file is required!"; } else { string filename = "~/Signature/" + RadioButtonList1.SelectedValue + "(" + DeliveryDate.getDeliveryDate() + ")" + ext; for (int i = 0; i < GridView1.Rows.Count; i++) { itemId = (GridView1.Rows[i].FindControl("lblItemId") as Label).Text; departmentId = (GridView1.Rows[i].FindControl("lblDepId") as Label).Text; iou = Int32.Parse((GridView1.Rows[i].FindControl("lblIouQty") as Label).Text); reqQty = Int32.Parse((GridView1.Rows[i].FindControl("lblrQty") as Label).Text); dQty = Int32.Parse((GridView1.Rows[i].FindControl("lblfQty") as Label).Text); retrunQty = Int32.Parse((GridView1.Rows[i].FindControl("lblrtQty") as Label).Text); deliveryDate = Convert.ToDateTime(DeliveryDate.getDeliveryDate()); reason = (GridView1.Rows[i].FindControl("DropDownList1") as DropDownList).SelectedItem.Text; if (reason.Equals("null")) { reason = "no return"; } var result = ent.Product_Disbursement.Where(x => x.Department_ID == departmentId && x.Item_ID == itemId && x.Delivery_Date == deliveryDate).FirstOrDefault(); if (result != null) { result.IOU_Quantity = iou; result.Requested_Quantity = reqQty; result.Delivery_Quantity = dQty; result.Return_Quantity = retrunQty; result.Reason = reason; result.Signature = filename; ent.SaveChanges(); } else { Product_Disbursement disburse = new Product_Disbursement(); disburse.Item_ID = itemId; disburse.Department_ID = departmentId; disburse.IOU_Quantity = iou; disburse.Requested_Quantity = reqQty; disburse.Delivery_Quantity = dQty; disburse.Return_Quantity = retrunQty; disburse.Delivery_Date = deliveryDate; disburse.Reason = reason; result.Signature = filename; ent.Product_Disbursement.Add(disburse); ent.SaveChanges(); } } } } catch (Exception ex) { lbUploadMessage.Text = "Record creation error! The following error occured: " + ex.Message; } }