protected void Page_Load(object sender, EventArgs e) { // h4DivHead.InnerText = "List of Request Template"; UCFormHeader1.FormHeaderText = "Request Template"; //Toolbar1.SetUserRights("MaterialRequest", "Summary", ""); // FillSites(); if (!IsPostBack) { if (Session["Lang"] == null) { Session["Lang"] = Request.UserLanguages[0]; } loadstring(); FillSites(); iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); tbTemplateLst.Visible = true; tbTemplateDetail.Visible = false; tabContainerReqTemplate.ActiveTabIndex = 0; objService.ClearTempDataFromDBNEW(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr); } GetTemplateList(); //Toolbar1.SetSaveRight(false, "Not Allowed"); //Toolbar1.SetClearRight(false, "Not Allowed"); this.UCToolbar1.evClickAddNew += pageAddNew; this.UCToolbar1.evClickSave += pageSave; this.UCToolbar1.evClickClear += pageClear; }
protected void GetTemplateList() { //select * from VW_GetTemplateDetails iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); GVRequest.DataSource = null; GVRequest.DataBind(); DataSet dsTemplate = new DataSet(); string UserType = profile.Personal.UserType.ToString(); if (UserType == "Super Admin") { dsTemplate = objService.GetTemplateDetailsSuperAdmin(profile.DBConnection._constr); } else if (UserType == "Admin") { dsTemplate = objService.GetTemplateDetailsAdmin(profile.Personal.UserID, profile.DBConnection._constr); } //else //{ // // dsTemplate = objService.GetTemplateDetails(profile.Personal.UserID, profile.DBConnection._constr); //} //dsTemplate = objService.GetTemplateDetails(profile.Personal.UserID, profile.DBConnection._constr); GVRequest.DataSource = dsTemplate; GVRequest.DataBind(); }
public static void WMUpdRequestPartPrice(object objRequest, int ProdID) { iPartRequestClient objService = new iPartRequestClient(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objRequest; CustomProfile profile = CustomProfile.GetProfile(); string uom = objService.GetUOMName(Convert.ToInt64(dictionary["UOMID"]), profile.DBConnection._constr); POR_SP_GetPartDetail_ForRequest_Result PartRequest = new POR_SP_GetPartDetail_ForRequest_Result(); PartRequest.Sequence = Convert.ToInt64(dictionary["Sequence"]); PartRequest.RequestQty = Convert.ToDecimal(dictionary["RequestQty"]); PartRequest.UOM = uom; PartRequest.UOMID = Convert.ToInt64(dictionary["UOMID"]); PartRequest.Total = Convert.ToDecimal(dictionary["Total"]); PartRequest.Price = Convert.ToDecimal(dictionary["Price"]); // PartRequest.IsPriceChange = Convert.ToInt16(dictionary["IsPriceChange"]); decimal price = Convert.ToDecimal(dictionary["Price"]); int ISPriceChangedYN = objService.IsPriceChanged(ProdID, price, profile.DBConnection._constr); if (ISPriceChangedYN == 0) { PartRequest.IsPriceChange = 0; } else { PartRequest.IsPriceChange = 1; } objService.UpdatePartRequest_TempData12(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), PartRequest, profile.DBConnection._constr); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "PartRequestEntry.aspx", "WMUpdRequestPart"); } finally { objService.Close(); } }
public static string WMSaveApproval(long RequestID, string ApprovalStatus, long APL, string ApprovalRemark, string InvoiceNo) { iPartRequestClient objService = new iPartRequestClient(); string result = ""; try { CustomProfile profile = CustomProfile.GetProfile(); if (ApprovalStatus == "3") { objService.UpdatetApprovalTransAfterApproval(APL, RequestID, 3, ApprovalRemark, profile.Personal.UserID, InvoiceNo, profile.DBConnection._constr); result = "true"; } else if (ApprovalStatus == "4") { objService.UpdatetApprovalTransAfterReject(APL, RequestID, 4, ApprovalRemark, profile.Personal.UserID, profile.DBConnection._constr); result = "true"; } else if (ApprovalStatus == "24") { objService.UpdatetApprovalTransAfterApproval(0, RequestID, 24, ApprovalRemark, profile.Personal.UserID, "0", profile.DBConnection._constr); result = "truerev"; } } catch { } finally { objService.Close(); } return(result); }
protected void GetRequestHeadByRequestID() { iPartRequestClient objService = new iPartRequestClient(); try { CustomProfile profile = CustomProfile.GetProfile(); POR_SP_GetRequestByRequestIDs_Result RequestHead = new POR_SP_GetRequestByRequestIDs_Result(); RequestHead = objService.GetRequestSummayByRequestIDs(Session["PORRequestID"].ToString(), profile.DBConnection._constr).FirstOrDefault(); if (RequestHead != null) { lblRequestNo.Text = RequestHead.PRH_ID.ToString(); lblRequestNo2.Text = RequestHead.PRH_ID.ToString(); hdnRequestID.Value = RequestHead.PRH_ID.ToString(); lblRequestDate.Text = RequestHead.RequestDate.Value.ToString("dd-MMM-yyyy"); lblRequestStatus.Text = RequestHead.RequestStatus.ToString(); lblSites.Text = RequestHead.SiteName.ToString(); hdnSiteID.Value = RequestHead.SiteID.ToString(); lblRequestType.Text = RequestHead.RequestType.ToString(); lblRequestedBy.Text = RequestHead.RequestByUserName.ToString(); GetReceiptHistoryByRequestID(); } } catch { } finally { objService.Close(); } }
public static int WMUpdateOrderProductDetails(decimal OrderQty, decimal Price, decimal Total) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); int Result = objService.UpdateOrderQtyTotal(OrderQty, Price, Total, OrderID, Sequence, profile.DBConnection._constr); return(Result); }
public static int WMChkDispatchedOrder(string SelectedOrder) { iPartRequestClient objServie = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); int result = objServie.GetDispatchedOrders(SelectedOrder, profile.DBConnection._constr); return(result); }
public void BindProductDetails(long OrderID, int Sequence, long UserID) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); int IsPriceEdit = objService.IsPriceEditYN(OrderID, UserID, profile.DBConnection._constr); int IsSkuChange = objService.IsSkuChangeYN(OrderID, UserID, profile.DBConnection._constr); if (IsPriceEdit == 1) { txtPrc.Disabled = false; } else { txtPrc.Disabled = true; } if (IsSkuChange == 1) { txtReqQty.Disabled = false; } else { txtReqQty.Disabled = true; } DataSet ds = new DataSet(); ds = objService.GetProductOfOrder(OrderID, Sequence, profile.DBConnection._constr); txtProductCode.Text = ds.Tables[0].Rows[0]["Prod_Code"].ToString(); txtProductName.Text = ds.Tables[0].Rows[0]["Prod_Name"].ToString(); txtProductDescription.Text = ds.Tables[0].Rows[0]["Prod_Description"].ToString(); txtMOQ.Text = ds.Tables[0].Rows[0]["moq"].ToString(); txtCurrentStock.Text = ds.Tables[0].Rows[0]["AvailableBalance"].ToString(); txtReserveStock.Text = ds.Tables[0].Rows[0]["ResurveQty"].ToString(); // txtReqQty.Value = ds.Tables[0].Rows[0]["OrderQty"].ToString(); txtOrderQty.Text = ds.Tables[0].Rows[0]["OrderQty"].ToString(); txtPrc.Value = ds.Tables[0].Rows[0]["Price"].ToString(); //txtPrice.Text = ds.Tables[0].Rows[0]["Price"].ToString(); txtTotal.Text = ds.Tables[0].Rows[0]["Total"].ToString(); int ProdID = int.Parse(ds.Tables[0].Rows[0]["SkuId"].ToString()); hdnSelectedProduct.Value = ProdID.ToString(); DataSet dsUOM = new DataSet(); dsUOM = objService.GetUOMofSelectedProduct(ProdID, profile.DBConnection._constr); ddlUOM.DataSource = dsUOM; ddlUOM.DataBind(); //ddlUOM.SelectedValue =ds.Tables[0].Rows[0]["UOMID"].ToString(); ddlUOM.SelectedIndex = ddlUOM.Items.IndexOf(ddlUOM.Items.FindByValue(ds.Tables[0].Rows[0]["UOMID"].ToString())); DataSet dsUOMSelPrd = new DataSet(); dsUOMSelPrd = objService.GetUOMofSelectedProduct(ProdID, profile.DBConnection._constr); int SelInd = 0; SelInd = ddlUOM.SelectedIndex; decimal SelectedQty = decimal.Parse(dsUOMSelPrd.Tables[0].Rows[SelInd]["Quantity"].ToString()); decimal UserQty = decimal.Parse(ds.Tables[0].Rows[0]["OrderQty"].ToString()); txtReqQty.Value = Convert.ToString(UserQty / SelectedQty); }
public static int WMCancelOrder(long SelectedOrder) { iPartRequestClient objServie = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); long UserID = profile.Personal.UserID; int result = objServie.CancelSelectedOrder(SelectedOrder, UserID, profile.DBConnection._constr); return(result); }
public static long WMGetQty(long SelectedProduct, long SelectedUOM) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); DataSet dsUOM = new DataSet(); dsUOM = objService.GetQtyofSelectedUOM(SelectedProduct, SelectedUOM, profile.DBConnection._constr); long Qty = long.Parse(dsUOM.Tables[0].Rows[0]["Quantity"].ToString()); return(Qty); }
//public string checkduplicate() //{ // try // { // CustomProfile profile = CustomProfile.GetProfile(); // iProductMasterClient productclient = new iProductMasterClient(); // string result = ""; // result = productclient.checkDuplicateRecord(txtProductName.Text.Trim(), profile.DBConnection._constr); // if (result != string.Empty) // { // WebMsgBox.MsgBox.Show(result); // } // txtProductName.Focus(); // return result; // } // catch (System.Exception ex) // { // Login.Profile.ErrorHandling(ex, this, "PartRequestEntry", "checkDuplicate"); // string result = ""; // return result; // } // finally // { // } //} protected void gvApprovalRemarkBind() { iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); gvApprovalRemark.DataSource = null; gvApprovalRemark.DataBind(); DataSet dsGetApprovalDetail = new DataSet(); dsGetApprovalDetail = objService.GetApprovalDetailsAllApproved(profile.DBConnection._constr); gvApprovalRemark.DataSource = dsGetApprovalDetail; gvApprovalRemark.DataBind(); }
protected void pageAddNew(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e) { iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); clearfields(); txtTitle.Focus(); tbTemplateLst.Visible = false; tbTemplateDetail.Visible = true; tabContainerReqTemplate.ActiveTabIndex = 1; hdnTemplateID.Value = ""; objService.ClearTempDataFromDBNEW(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr); }
public static int WMAssignDriver(long hndSelectedRec, string OrderID, string TruckDetails) { iPartRequestClient assignDriver = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); string[] eorder = OrderID.Split(','); int cnt = eorder.Count(); for (int i = 0; i <= cnt - 1; i++) { assignDriver.AssignSelectedDriver(long.Parse(eorder[i].ToString()), hndSelectedRec, TruckDetails, profile.Personal.UserID, profile.DBConnection._constr); } return(1); }
protected void FillGVRequest(string FillBy, string Invoker) { iPartRequestClient objServie = new iPartRequestClient(); try { CustomProfile profile = CustomProfile.GetProfile(); GVRequest.DataSource = null; GVRequest.DataBind(); //New Added By Suresh for GWC string UserType = profile.Personal.UserType.ToString(); //New Added By Suresh for GWC if (FillBy == "UserID") { if (Invoker == "Request") { if (UserType == "User" || UserType == "Requester" || UserType == "Requestor") { GVRequest.DataSource = objServie.GetRequestSummayOfUser(profile.Personal.UserID, profile.DBConnection._constr); } else { GVRequest.DataSource = objServie.GetRequestSummayByUserID(profile.Personal.UserID, profile.DBConnection._constr); } GVRequest.Columns[12].Visible = false; GVRequest.AllowMultiRecordSelection = true; GVRequest.AllowRecordSelection = true; } else if (Invoker == "Issue") { if (UserType == "User" || UserType == "Requester" || UserType == "Requestor") { GVRequest.DataSource = objServie.GetRequestSummayOfUserIssue(profile.Personal.UserID, profile.DBConnection._constr); } else { GVRequest.DataSource = objServie.GetRequestSummayByUserIDIssue(profile.Personal.UserID, profile.DBConnection._constr); } GVRequest.Columns[12].Visible = true; GVRequest.AllowMultiRecordSelection = true; GVRequest.AllowRecordSelection = true; } } else if (FillBy == "SiteIDs") { GVRequest.DataSource = objServie.GetRequestSummayBySiteIDs(Session["SiteIDs"].ToString(), profile.DBConnection._constr); } GVRequest.DataBind(); } catch { } finally { objServie.Close(); } }
public static List <POR_SP_GetRequestByRequestIDs_Result> WMGetRequestHead(string RequestIDs) { iPartRequestClient objService = new iPartRequestClient(); List <POR_SP_GetRequestByRequestIDs_Result> RequestHead = new List <POR_SP_GetRequestByRequestIDs_Result>(); try { CustomProfile profile = CustomProfile.GetProfile(); RequestHead = objService.GetRequestSummayByRequestIDs(RequestIDs, profile.DBConnection._constr).ToList(); } catch { } finally { objService.Close(); } return(RequestHead); }
public void GetInvoiceNo(string OrderID) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); string InvNo = objService.GetInvoiceNoofOrder(long.Parse(OrderID), profile.DBConnection._constr); if (InvNo == "0") { txtInvoiceNo.Text = ""; } else { txtInvoiceNo.Text = InvNo; } }
protected void fillGrid(string PrdID) { iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); GVBOMDetail.DataSource = null; GVBOMDetail.DataBind(); DataSet dsBomDetails = new DataSet(); dsBomDetails = objService.GetBomDetails(PrdID, profile.DBConnection._constr); GVBOMDetail.DataSource = dsBomDetails; GVBOMDetail.DataBind(); }
public static decimal WMGetTotalQty() { iPartRequestClient objService = new iPartRequestClient(); decimal tot = 0; try { CustomProfile profile = CustomProfile.GetProfile(); POR_SP_GetPartDetail_ForRequest_Result PartRequest = new POR_SP_GetPartDetail_ForRequest_Result(); tot = objService.GetTotalQTYFromTempData(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), profile.DBConnection._constr); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "PartRequestEntry.aspx", "WMGetTotalQty"); } finally { objService.Close(); } return(tot); }
protected void GetMessageList() { iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); GVMessage.DataSource = null; GVMessage.DataBind(); DataSet dsMessage = new DataSet(); dsMessage = objService.GetGetMessageDetails(profile.DBConnection._constr); GVMessage.DataSource = dsMessage; GVMessage.DataBind(); }
public static void WMRemovePartFromRequest(Int32 Sequence) { iPartRequestClient objService = new iPartRequestClient(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); CustomProfile profile = CustomProfile.GetProfile(); objService.RemovePartFromRequest_TempData(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Sequence, profile.DBConnection._constr); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "Request Template", "WMRemovePartFromRequest"); } finally { objService.Close(); } }
public void ShowData(string CORID) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); tCorrespond Cor = new tCorrespond(); Cor = objService.GetCorrespondanceDetail(long.Parse(CORID.ToString()), profile.DBConnection._constr); txtSubject.Text = Cor.MessageTitle; hdnmsgbody.Value = Cor.Message.ToString(); lblAddHTMLQuestionInRichBox.Visible = true; txtSubject.Enabled = false; // editEmail.Enabled = false; btnSubmit.Visible = false; }
protected void GetTemplateList() { //select * from VW_GetTemplateDetails HttpContext.Current.Session["ReportDS"] = dsCmnRpt; iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); GVRequest.DataSource = null; GVRequest.DataBind(); long DeptID = long.Parse(Session["DeptID"].ToString()); DataSet dsTemplate = new DataSet(); dsTemplate = objService.GetTemplateDetailsBind(profile.Personal.UserID, DeptID, profile.DBConnection._constr); // dsTemplate = objService.GetTemplateDetails(profile.Personal.UserID, profile.DBConnection._constr); GVRequest.DataSource = dsTemplate; GVRequest.DataBind(); }
protected void Grid1_OnRebind(object sender, EventArgs e) { iPartRequestClient objService = new iPartRequestClient(); try { Grid1.DataSource = null; Grid1.DataBind(); CustomProfile profile = CustomProfile.GetProfile(); HiddenField hdn = (HiddenField)UCProductSearch1.FindControl("hdnProductSearchSelectedRec"); List <POR_SP_GetPartDetail_ForRequest_Result> RequestPartList = new List <POR_SP_GetPartDetail_ForRequest_Result>(); if (hdn.Value == "") { RequestPartList = objService.GetExistingTempDataBySessionIDObjectName(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList(); } else if (hdn.Value != "") { RequestPartList = objService.AddPartIntoRequest_TempData(hdn.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, 0, profile.DBConnection._constr).ToList(); } ////Add by Suresh //if (hdnprodID.Value != "") //{ // RequestPartList = objService.AddPartIntoRequest_TempData(hdnprodID.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Convert.ToInt32(ddlSites.SelectedItem.Value), profile.DBConnection._constr).ToList(); // hdnprodID.Value = ""; //} if (hdnChngDept.Value == "0x00x0") { objService.ClearTempDataFromDBNEW(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr); RequestPartList = null; } hdnChngDept.Value = ""; var chngdpt = "1x1"; hdnChngDept.Value = chngdpt; Grid1.DataSource = RequestPartList; Grid1.DataBind(); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Request Template", "Grid1_OnRebind"); } finally { objService.Close(); } }
protected void RebindGrid(object sender, EventArgs e) { iPartRequestClient assignDriver = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); var SearchedValue = hdnFilterText.Value; DataSet ds = new DataSet(); if (SearchedValue == "") { ds = assignDriver.GetDriverDetails(profile.DBConnection._constr); } else { ds = assignDriver.GetFilteredDriverList(SearchedValue, profile.DBConnection._constr); } GVDriver.DataSource = ds; GVDriver.DataBind(); }
protected void Grid1_RowCommand(object sender, Obout.Grid.GridRowEventArgs e) { iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); try { Obout.Grid.GridDataControlFieldCell cell = e.Row.Cells[6] as Obout.Grid.GridDataControlFieldCell; DropDownList ddl = cell.FindControl("ddlUOM") as DropDownList; ddl.Attributes.Add("onchange", "javascript:GetIndex('" + ddl.SelectedIndex + "'," + e.Row.RowIndex + ")"); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Request Template", "Grid1_RowCommand"); } finally { objService.Close(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); tCorrespond Cor = new tCorrespond(); string MessageBody = hdnmsgbody.Value; string MsgTitle = txtSubject.Text; if (MsgTitle == "") { Response.Write("<script>"); Response.Write("showAlert('Enter Subject ', 'Error', '#');"); txtSubject.Focus(); Response.Write("</script>"); } else if (MessageBody == "" || MessageBody == "andBrSt;brandBrEn;\r\n") { Response.Write("<script>"); Response.Write("showAlert('Enter Message Body ', 'Error', '#');"); Response.Write("</script>"); } else { long OrderHeadId = long.Parse(RequestID.ToString()); Cor.date = DateTime.Now; Cor.Message = MessageBody; Cor.MessageFrom = profile.Personal.UserID; Cor.MessageTitle = MsgTitle; Cor.OrderHeadId = OrderHeadId; Cor.Archive = false; Cor.MailStatus = 1; objService.InsertIntotCorrespond(Cor, profile.DBConnection._constr); Response.Write("<script>"); Response.Write("window.opener.GVInboxPOR.refresh();"); Response.Write("self.close();"); Response.Write("</script>"); } }
public static string WMAddMessage(string hdnmsgbody, string Subject) { CustomProfile profile = CustomProfile.GetProfile(); iPartRequestClient objService = new iPartRequestClient(); tCorrespond Cor = new tCorrespond(); string MessageBody = hdnmsgbody; long OrderHeadId = Convert.ToInt64(HttpContext.Current.Session["PORRequestID"].ToString());// long.Parse(RequestID.ToString()); Cor.date = DateTime.Now; Cor.Message = MessageBody; Cor.MessageFrom = profile.Personal.UserID; Cor.MessageTitle = Subject; Cor.OrderHeadId = OrderHeadId; objService.InsertIntotCorrespond(Cor, profile.DBConnection._constr); return("true"); }
public static void WMUpdateRequestQty(object objRequest) { iPartRequestClient objService = new iPartRequestClient(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objRequest; CustomProfile profile = CustomProfile.GetProfile(); POR_SP_GetPartDetail_ForRequest_Result PartRequest = new POR_SP_GetPartDetail_ForRequest_Result(); PartRequest.Sequence = Convert.ToInt64(dictionary["Sequence"]); PartRequest.RequestQty = Convert.ToDecimal(dictionary["RequestQty"]); objService.UpdatePartRequest_TempData(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), PartRequest, profile.DBConnection._constr); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "Request Template", "WMUpdateRequestQty"); } finally { objService.Close(); } }
public void ProcessRequest(HttpContext context) { SqlConnection conn = new SqlConnection(strcon); long aprId = Convert.ToInt64(context.Request.Form["aprId"]); string OdrID = context.Request.Form["reqId"]; String reqAct = context.Request.Form["reqAct"]; SqlCommand cmd3 = new SqlCommand(); SqlDataAdapter da3 = new SqlDataAdapter(); DataTable dt3 = new DataTable(); DataSet ds3 = new DataSet(); cmd3.CommandType = CommandType.Text; cmd3.CommandText = "select Id from tOrderHead where OrderNo='" + OdrID + "'"; cmd3.Connection = conn; cmd3.Parameters.Clear(); //cmd.Parameters.AddWithValue("param1", ResourceId); da3.SelectCommand = cmd3; da3.Fill(ds3, "tbl4"); dt3 = ds3.Tables[0]; long reqId = Convert.ToInt32(dt3.Rows[0]["Id"].ToString()); long statusId = 0; if (reqAct == "Approved") { statusId = 3; } else if (reqAct == "Rejected") { statusId = 4; } string reqRemark = context.Request.Form["reqRemark"]; string aprUserName = context.Request.Form["aprUserName"]; string InvNo = ""; InvNo = context.Request.Form["reqInvoiceNo"]; CustomProfile profile = CustomProfile.GetProfile(aprUserName); String xmlString = String.Empty; context.Response.ContentType = "text/xml"; xmlString = xmlString + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xmlString = xmlString + "<gwcInfo>"; xmlString = xmlString + "<approvalAction>"; iPartRequestClient objService = new iPartRequestClient(); try { SqlCommand cmd1 = new SqlCommand(); SqlDataAdapter da1 = new SqlDataAdapter(); DataTable dt1 = new DataTable(); DataSet ds1 = new DataSet(); cmd1.Connection = conn; cmd1.CommandType = CommandType.Text; cmd1.CommandText = "select * from VW_ApprovalTransDetails where OrderID=" + reqId + " and approverID=" + aprId + " and Status !=3"; da1.SelectCommand = cmd1; da1.Fill(ds1, "dtl"); dt1 = ds1.Tables[0]; if (dt1.Rows.Count > 0) { long aprovalid = Convert.ToInt64(dt1.Rows[0]["ApprovalID"].ToString()); if (statusId == 3) { objService.UpdatetApprovalTransAfterApproval(aprovalid, reqId, statusId, CheckString(reqRemark), aprId, InvNo, profile.DBConnection._constr); } else if (statusId == 4) { objService.UpdatetApprovalTransAfterReject(aprovalid, reqId, statusId, CheckString(reqRemark), aprId, profile.DBConnection._constr); } xmlString = xmlString + "<authmsg>success</authmsg>"; } } catch { xmlString = xmlString + "<authmsg>failed</authmsg>"; } xmlString = xmlString + "</approvalAction>"; xmlString = xmlString + "</gwcInfo>"; context.Response.Write(xmlString); }
protected void btnnext_Click(object sender, EventArgs e) { DataSet ds1 = new DataSet(); DataTable dt1 = new DataTable(); iProductMasterClient productClient = new iProductMasterClient(); iPartRequestClient objService = new iPartRequestClient(); CustomProfile profile = CustomProfile.GetProfile(); decimal TotalProdQty = 0m, totalPrice = 0m; string Title = "Direct Order Import"; string OrderNumber = ""; DateTime orderdate = DateTime.Now; try { ds = productClient.GetDistinctPLCodes(profile.DBConnection._constr); //ds = productClient.GetDirectOrderData(profile.DBConnection._constr); dt = ds.Tables[0]; for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { DataSet ds2 = new DataSet(); DataTable dt2 = new DataTable(); long disDeptid = long.Parse(ds.Tables[0].Rows[i]["deptId"].ToString()); long DisLocId = long.Parse(ds.Tables[0].Rows[i]["LocID"].ToString()); long CompanyID = long.Parse(ds.Tables[0].Rows[i]["ParentID"].ToString()); long Orderheadid = 0; ds2 = productClient.GetTotalForOrderHead(disDeptid, DisLocId, profile.DBConnection._constr); dt2 = ds2.Tables[0]; if (dt2.Rows.Count > 0) { TotalProdQty = decimal.Parse(dt2.Rows[0]["TotalOrderQty"].ToString()); totalPrice = decimal.Parse(dt2.Rows[0]["GrandTotalPrice"].ToString()); } OrderNumber = productClient.getOrderFormatNumber(disDeptid, profile.DBConnection._constr); ds1 = productClient.GetImportDatabyDisDeptLocId(disDeptid, DisLocId, profile.DBConnection._constr); dt1 = ds1.Tables[0]; long sequence = 0; for (int j = 0; j <= ds1.Tables[0].Rows.Count - 1; j++) { long UOMID = 16; string skucode = ds1.Tables[0].Rows[j]["SKUCode"].ToString(); string SkuName = ds1.Tables[0].Rows[j]["Name"].ToString(); string Description = ds1.Tables[0].Rows[j]["Description"].ToString(); decimal AvailableBalance = decimal.Parse(ds1.Tables[0].Rows[j]["AvailableBalance"].ToString()); decimal RequestQty = decimal.Parse(ds1.Tables[0].Rows[j]["asRequestQty"].ToString()); decimal OrderQty = decimal.Parse(ds1.Tables[0].Rows[j]["OrderQty"].ToString()); decimal Price = decimal.Parse(ds1.Tables[0].Rows[j]["Price"].ToString()); decimal Total = decimal.Parse(ds1.Tables[0].Rows[j]["Total"].ToString()); long locationid = long.Parse(ds1.Tables[0].Rows[j]["locationid"].ToString()); long prodID = long.Parse(ds1.Tables[0].Rows[j]["prodID"].ToString()); long storeID = long.Parse(ds1.Tables[0].Rows[j]["ID"].ToString()); decimal Dispatch = decimal.Parse(ds1.Tables[0].Rows[j]["TotalDispatchQty"].ToString()); //TotalProdQty = TotalProdQty + OrderQty; //totalPrice = totalPrice + Total; long maxdeldays = productClient.GetmaxDeliverydays(storeID, profile.DBConnection._constr); DateTime Deliveryday = DateTime.Now.AddDays(maxdeldays); decimal CurrentAvailBalance = AvailableBalance - OrderQty; decimal CurrentDispatchQty = Dispatch + OrderQty; sequence = sequence + 1; if (j == 0) { Orderheadid = productClient.SaveOrderHeaderImport(storeID, orderdate, Deliveryday, 0, 3, profile.Personal.UserID, DateTime.Now, Title, DateTime.Now, TotalProdQty, totalPrice, OrderNumber, locationid, profile.DBConnection._constr); } productClient.SaveOrderDetailImport(Orderheadid, prodID, OrderQty, UOMID, sequence, SkuName, Description, skucode, Price, Total, profile.DBConnection._constr); productClient.updateproductstockdetailimport(storeID, prodID, CurrentAvailBalance, CurrentDispatchQty, profile.DBConnection._constr); } productClient.ImportMsgTransHeader(Orderheadid, profile.DBConnection._constr); int x = objService.EmailSendWhenRequestSubmit(Orderheadid, profile.DBConnection._constr); DataSet dss = new DataSet(); dss = objService.GetApproverDepartmentWise(disDeptid, profile.DBConnection._constr); for (int t = 0; t <= dss.Tables[0].Rows.Count - 1; t++) { long approverid = Convert.ToInt64(dss.Tables[0].Rows[t]["UserId"].ToString()); objService.EmailSendofApproved(approverid, Orderheadid, profile.DBConnection._constr); } } productClient.DeleteOrderImport(profile.DBConnection._constr); Response.Redirect("ImportOrderF.aspx"); } catch { productClient.DeleteSKUPricetemp(profile.DBConnection._constr); } finally { productClient.Close(); } }