public DataTable getExpiredWHRsonTruck(Guid warehouseid) { DataTable dt = new DataTable(); WarehouseRecieptBLL whrbll = new WarehouseRecieptBLL(); dt = whrbll.getexpiredWHRsOnTruck(warehouseid); return(dt); }
public void BindApprovalGrid(Guid warehouseid) { DataTable dt = new DataTable(); WarehouseRecieptBLL whrbll = new WarehouseRecieptBLL(); dt = whrbll.getexpiredWHRsOnTruck(warehouseid); grvGRNApproval.DataSource = dt; grvGRNApproval.DataBind(); }
public void UpdateReceipt() { string GRNNo = txtGRNNo.Text; Guid LICName2 = new Guid(ddLIC.SelectedValue.ToString()); //Guid Shed = new Guid(); string Shed = DDLShed.SelectedItem.ToString(); GRN_BL objGrnNew = new GRN_BL(); GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRNNo); WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld); objWR.EditWHRtoWarehouse(GRNNo, Shed); }
protected void GRNApprovalEdit() { string dateEntered; string timeEntered; Guid GRNNo; string GRN_No; int response; Messages1.ClearMessage(); int countError = 0; dateEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtDateTimeLICSigned")).Text; timeEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtTimeLICSigned")).Text; GRNNo = new Guid(grvGRNApproval.DataKeys[0].Value.ToString()); GRN_No = ((Label)grvGRNApproval.Rows[0].FindControl("lblGRNNo")).Text; response = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue); if (dateEntered == "" || timeEntered == "") { Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning); countError++; } if (countError == 0) { try { GRNApprovalModel.UpdateGRNSupervisorApproval(GRNNo, UserBLL.CurrentUser.UserId, response, (DateTime.Parse(dateEntered + " " + timeEntered)), DateTime.Now); // if Superevisor Accept it create WarehouseReciept.... if (response == 1) { GRN_BL objGrnNew = new GRN_BL(); GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No); WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld); objWR.Save(); } BindGRNApprovalGridviewForEdit(); Messages1.SetMessage("Updated successfully.", Messages.MessageType.Success); } catch (Exception ex) { Messages1.SetMessage(ex.Message, Messages.MessageType.Error); } } else { btnApprove.Style["visibility"] = "visible"; } }
protected void GRNApprovalBySupervisor() { string dateEntered; string timeEntered; string GRNNo; string GRN_No; int response; Messages1.ClearMessage(); int countError = 0; string GRNApprovalXML = "<GRNApproval>"; foreach (GridViewRow gvr in this.grvGRNApproval.Rows) { if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true) { // check if date and time is not empty dateEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text; timeEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text; GRNNo = grvGRNApproval.DataKeys[gvr.RowIndex].Value.ToString(); GRN_No = ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblGRNNo")).Text; response = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue); // if Superevisor Accept it create WarehouseReciept.... if (response == 1) { GRN_BL objGrnNew = new GRN_BL(); GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No); WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld); objWR.Save(); } if (dateEntered == "" || timeEntered == "") { Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning); countError++; } if (countError == 0) { GRNApprovalXML += "<GRNApprovalItem> <ID>" + GRNNo + "</ID>" + "<WarehouseSupervisorApprovedBy>" + UserBLL.CurrentUser.UserId + "</WarehouseSupervisorApprovedBy>" + "<WarehouseSupervisorApprovedDateTime>" + dateEntered + " " + timeEntered + "</WarehouseSupervisorApprovedDateTime>" + "<WarehouseSupervisorApprovedTimeStamp>" + DateTime.Now + "</WarehouseSupervisorApprovedTimeStamp>" + "<WarehouseSupervisorStatus>" + response + "</WarehouseSupervisorStatus>" + "<Status>" + 3 + "</Status>" + "<StackID>" + ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblStackID")).Text + "</StackID>" + "</GRNApprovalItem>"; } } } if (countError == 0) { try { GRNApprovalXML += "</GRNApproval>"; GRNApprovalModel.ApproveGRNBySupervisor(GRNApprovalXML); BindGRNApprovalGridview(); Messages1.SetMessage("Approved successfully.", Messages.MessageType.Success); BindLIC(status); } catch (Exception ex) { Messages1.SetMessage(ex.Message, Messages.MessageType.Error); } } else { btnApprove.Style["visibility"] = "visible"; } }
protected void grvGRNApproval_SelectedIndexChanged(object sender, EventArgs e) { Guid ID, StackID; DateTime LICApprovedDate; string dateEntered, timeEntered, GRN_No, message; int response; ID = new Guid(grvGRNApproval.SelectedDataKey.Value.ToString()); StackID = new Guid(((Label)grvGRNApproval.SelectedRow.FindControl("lblStackID")).Text); dateEntered = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtDateTimeLICSigned")).Text; timeEntered = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtTimeLICSigned")).Text; GRN_No = ((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNNo")).Text; response = int.Parse(((DropDownList)grvGRNApproval.SelectedRow.FindControl("drpLICStatus")).SelectedValue); LICApprovedDate = DateTime.Parse(((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNCreatedDate")).Text); if (isValidDateTime(dateEntered, timeEntered, LICApprovedDate)) { try { if (((bool)ViewState["edit"])) { GRNApprovalModel.UpdateGRNSupervisorApproval(ID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now); BindGRNApprovalGridviewForEdit(); message = "Updated successfully."; } else { if (response == 1) //if Superevisor Accept it create WarehouseReciept.... { GRN_BL objGrnNew = new GRN_BL(); GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No); // Create the TransactionScope to execute the commands TransactionOptions option = new TransactionOptions(); option.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; option.Timeout = new TimeSpan(0, 0, 60); using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, option)) { GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now); BindGRNApprovalGridview(); //create WarehouseReciept WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld); objWR.Save2(); // The Complete method commits the transaction transaction.Complete(); } } else { GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now); BindGRNApprovalGridview(); } message = "Approved successfully"; Messages1.SetMessage(message, Messages.MessageType.Success); } } catch (Exception ex) { Messages1.SetMessage("Unable to save record. Please try again.", WarehouseApplication.Messages.MessageType.Error); } } }