private DataTable GetprojectList() { DataSet dsPrjList = null; try { dsPrjList = SqlHelper.ExecuteDataSet(Data.ConnectionString, CommandType.StoredProcedure, "sp_ProjectList"); if (dsPrjList == null || dsPrjList.Tables == null) { return(null); } } catch (Exception ex) { Session["errorMessage"] = ex.Message; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OKErrors", "Main.setMasterMessage('" + GeneralFunctions.UrlFullEncode(ex.Message) + "','');", true); return(null); } return(dsPrjList.Tables[0]); }
protected bool DataValidation() { bool valid = true; string lsUsers = string.Empty, lsProject = string.Empty; List <string> UserList = new List <string>(); List <string> ProjectList = new List <string>(); UserList = GetUserList(); ProjectList = GetProjectList(); for (int x = 1; x < this.FileLines.Count; x++) { string[] rowData = FileLines[x].ToString().Split(','); if (!UserList.Contains(rowData[0])) { lsUsers = (string.IsNullOrEmpty(lsUsers) ? rowData[0] : lsUsers + "; " + rowData[0]); valid = false; } if (!ProjectList.Contains(rowData[1])) { lsProject = (string.IsNullOrEmpty(lsProject) ? rowData[1] : lsProject + "; " + rowData[1]); valid = false; } } if (!valid) { StatusLabel.ForeColor = System.Drawing.Color.Red; StatusLabel.Font.Bold = true; string lsMsg = "Import Status: fail. Users invalid: " + lsUsers + ". Projects invalid: " + lsProject; StatusLabel.Text = "Import Status: fail. <br/> Users invalid: " + lsUsers + ". <br/> Projects invalid: " + lsProject;; Session["errorMessage"] = lsMsg; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OKErrors", "Main.setMasterMessage('" + GeneralFunctions.UrlFullEncode(lsMsg) + "','');", true); } return(valid); }
private bool postJVForBillingAct() { DocumentXML objInfo = new DocumentXML(); DataSet dsJV; DataTable tbCompany = dtJVLineCost.DefaultView.ToTable(true, "Company");//true: distinct Array arrContentsCols = new string[] { "Debit", "Credit" }; DataTable eachCompany; eachCompany = new DataTable("BTF1"); eachCompany = dtJVLineCost.Clone(); SAP.WebServices.Transaction ts = new WebServices.Transaction(); ts.Timeout = 1000000; foreach (DataRow row in tbCompany.Rows) { String companyName = row["Company"].ToString(); dsJV = new DataSet("DS"); dsJV.Tables.Add(dtJVHeader.Copy()); DataRow[] drows; eachCompany.Rows.Clear(); drows = dtJVLineCost.Select("Company = '" + companyName + "' AND (Debit <> 0 OR Credit <> 0)"); if (drows.Length > 0) { //string newact = ""; foreach (DataRow rw in drows) { DataRow dr = eachCompany.NewRow(); dr["Company"] = rw["Company"]; string act = rw["Account"].ToString(); //newact = act.Substring(0, 5) + "-" + act.Substring(5, 2) + "-" + act.Substring(7, 2); // "_SYS00000000189";// newact; dr["Account"] = act; dr["Debit"] = rw["Debit"]; dr["Credit"] = rw["Credit"]; dr["Project"] = rw["Project"]; eachCompany.Rows.Add(dr); } //dsJV.Tables.Add(eachCompany.Copy()); dsJV.Tables.Add(GF.ResetFormatNumeric(eachCompany.Copy(), arrContentsCols)); String xmlStrJV = objInfo.ToXMLStringFromDS("28", dsJV); //2. post to SAP (JV) DataSet dsResult = ts.CreateMarketingDocument(xmlStrJV, companyName, "28", "", false);//User.Identity.Name if ((int)dsResult.Tables[0].Rows[0]["ErrCode"] != 0) { this.lbError.Text = dsResult.Tables[0].Rows[0]["ErrMsg"].ToString(); Session["errorMessage"] = dsResult.Tables[0].Rows[0]["ErrMsg"]; Session["requestXML"] = xmlStrJV; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OKErrors", "Main.setMasterMessage('" + GeneralFunctions.UrlFullEncode(dsResult.Tables[0].Rows[0]["ErrMsg"].ToString() + "-" + xmlStrJV) + "','');", true); return(false); } } } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "CloseLoading", "Dialog.hideLoader();", true); return(true); }