public bool CreateOpDamages(DataTable ResultTable) { bool flag = false; if (this.TryConnection()) { ArrayList sqla = new ArrayList(); DatabaseParameters keys = new DatabaseParameters(); foreach (DataRow row in ResultTable.Rows) { keys.Clear(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.DamageCode.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.DamageCode.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.DamageDescription.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.DamageDescription.ActualFieldName].ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.DamageGroup.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.DamageGroup.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.DamageOrder.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.DamageOrder.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.InternalID.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.InternalID.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.NotificationID.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.NotificationID.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpDamages.OpSys.ActualFieldName, row[this.DataStructrure.Tables.OpDamages.OpSys.ActualFieldName].ToString())); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpDamages.ActualTableName); sqla.Add(base.CurSQLFactory.SQL); } if (!(flag = base.CurDBEngine.ExecuteQuery(sqla))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[OpDamagesManager] : CreateOpDamages : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpDamagesManager] : CreateOpDamages : " + base.ErrMsg; return(flag); }
public bool CreateMasterCheckListRelation(DataTable SourceTable) { bool flag = false; if (SourceTable != null) { ArrayList sqla = new ArrayList(); if (this.TryConnection()) { DatabaseParameters keys = new DatabaseParameters(); foreach (DataRow row in SourceTable.Rows) { keys.Clear(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.MasterCheckListRelation.ChecklistType.ActualFieldName, row[this.DataStructrure.Tables.MasterCheckListRelation.ChecklistType.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.MasterCheckListRelation.DistChannel.ActualFieldName, row[this.DataStructrure.Tables.MasterCheckListRelation.DistChannel.ActualFieldName].ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.MasterCheckListRelation.PlantNo.ActualFieldName, row[this.DataStructrure.Tables.MasterCheckListRelation.PlantNo.ActualFieldName].ToString())); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.MasterCheckListRelation.ActualTableName); sqla.Add(base.CurSQLFactory.SQL); } if (!(flag = base.CurDBEngine.ExecuteQuery(sqla))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[MasterCheckListManager] : CreateMasterCheckListRelation : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[MasterCheckListManager] : CreateMasterCheckListRelation : " + base.ErrMsg; } return(flag); }
protected bool UpdateDirectExpense() { bool smooth = true; if (DataValidation()) { ArrayList sqlList = new ArrayList(); DatabaseParameters KeyParameters = new DatabaseParameters(); CultureInfo ivC = new CultureInfo("es-US"); DateTime lfromdate = Convert.ToDateTime(txtFromDate.Text, ivC); DateTime ltodate = Convert.ToDateTime(txtToDate.Text, ivC); // now insert new if (this.FileLines != null) { // Delete data before import new lfromdate = Convert.ToDateTime(txtFromDate.Text, ivC); ltodate = Convert.ToDateTime(txtToDate.Text, ivC); KeyParameters.Add(new DatabaseParameter("CONVERT(VARCHAR(8), [Date], 112)", lfromdate.ToString("yyyyMMdd"), DBDataType.String, DBLinkage.AND, DBCompareType.LargerNEqual)); KeyParameters.Add(new DatabaseParameter("CONVERT(VARCHAR(8), [Date], 112)", ltodate.ToString("yyyyMMdd"), DBDataType.String, DBLinkage.AND, DBCompareType.SmallerNEqual)); // delete before insert SqlHelper.DeleteCommand(KeyParameters, "tbl_DirectExpense"); sqlList.Add(SqlHelper.SQL); for (int x = 1; x < this.FileLines.Count; x++) { string[] rowData = FileLines[x].ToString().Split(','); KeyParameters.Clear(); string lsID = Guid.NewGuid().ToString(); KeyParameters.Add(new DatabaseParameter("internal_id", lsID)); KeyParameters.Add(new DatabaseParameter("PrjCode", rowData[0])); KeyParameters.Add(new DatabaseParameter("Date", Convert.ToDateTime(rowData[1], ivC))); KeyParameters.Add(new DatabaseParameter("Amount", rowData[2])); KeyParameters.Add(new DatabaseParameter("SAPB1DB", "UserImported")); SqlHelper.InsertCommand(KeyParameters, "tbl_DirectExpense"); sqlList.Add(SqlHelper.SQL); } } if (!(smooth = SqlHelper.ExecuteQuery(sqlList, Data.ConnectionString))) { StatusLabel.Text = SqlHelper.ErrMsg; } else { Response.Redirect("/TimeSheet/DirectExpenseEntry.aspx?fromdate=" + lfromdate.ToString("MM/dd/yyyy") + "&todate=" + ltodate.ToString("MM/dd/yyyy")); Binding(); StatusLabel.Text = "Import Direct Expense Entry Successful."; } } return(smooth); }
private void AddUpdateItem(Int32 itemNo, Dictionary <string, string> dic) { if (dic != null) { int liNoP = int.Parse(dic["NoP"]); DateTime StartDate = Convert.ToDateTime(dic["StartDate"], new CultureInfo("es-US")); if (DataValidation(StartDate, liNoP)) { ArrayList sqlList = new ArrayList(); DatabaseParameters KeyParameters = new DatabaseParameters(); for (int i = 0; i < liNoP; i++) { DateTime dt = StartDate.AddMonths(i); KeyParameters.Clear(); KeyParameters.Add(new DatabaseParameter("Starting_Date", dt.ToString("MM/dd/yyyy"))); KeyParameters.Add(new DatabaseParameter("Closed", "0")); KeyParameters.Add(new DatabaseParameter("Date_Locked", "0")); KeyParameters.Add(new DatabaseParameter("CreatedUser", User.Identity.Name)); KeyParameters.Add(new DatabaseParameter("CreatedDate", DateTime.Now.ToString("MM/dd/yyyy"))); SqlHelper.InsertCommand(KeyParameters, "tbl_TimsheetPostingPeriod"); sqlList.Add(SqlHelper.SQL); } if (!(SqlHelper.ExecuteQuery(sqlList, Data.ConnectionString))) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OKErrors", "Main.setMasterMessage('" + SqlHelper.ErrMsg + "','');", true); } else { Response.Redirect("/TimeSheet/TimesheetPosting.aspx?year=" + ddl_Year.SelectedValue); } } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "OKErrors", "Main.setMasterMessage('Cannot Create Posting Period. It is existed','');", true); } } }
public bool CreateOpQuotationDetail(OpQuotationDetailCollection ListOfOpQuotationDetailObj, string QuotationID) { bool flag = false; if (this.TryConnection()) { ArrayList sqla = new ArrayList(); DatabaseParameters keys = new DatabaseParameters(); DatabaseParameters parameters2 = new DatabaseParameters(); parameters2.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName, QuotationID)); base.CurSQLFactory.DeleteCommand(parameters2, this.DataStructrure.Tables.OpQuotationDetail.ActualTableName); sqla.Add(base.CurSQLFactory.SQL); foreach (OpQuotationDetailObj obj2 in ListOfOpQuotationDetailObj) { keys.Clear(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName, obj2.InternalID)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Description.ActualFieldName, obj2.Description.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailNo.ActualFieldName, obj2.DetailNo.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName, obj2.Quotation.InternalID.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Quantity.ActualFieldName, obj2.Quantity.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Rate.ActualFieldName, obj2.Rate.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Discount.ActualFieldName, obj2.Discount.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.PartNo.ActualFieldName, obj2.PartNo.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.TotalPrice.ActualFieldName, obj2.TotalPrice.ToString())); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpQuotationDetail.ActualTableName); sqla.Add(base.CurSQLFactory.SQL); } if (!(flag = base.CurDBEngine.ExecuteQuery(sqla))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[OpQuotationDetailManager] : CreateOpQuotationDetail : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpQuotationDetailManager] : CreateOpQuotationDetail : " + base.ErrMsg; return(flag); }
protected bool UpdateResourcesPlanning() { bool smooth = true; if (DataValidation()) { ArrayList sqlList = new ArrayList(); DatabaseParameters KeyParameters = new DatabaseParameters(); CultureInfo ivC = new CultureInfo("es-US"); DateTime lfromdate = Convert.ToDateTime(txtFromDate.Text, ivC); DateTime ltodate = Convert.ToDateTime(txtToDate.Text, ivC); // now insert new if (this.FileLines != null) { // string[] header = this.FileLines[0].ToString().Split(','); // Delete data before import new lfromdate = Convert.ToDateTime(header[2], ivC); ltodate = Convert.ToDateTime(header[header.Length - 1], ivC); KeyParameters.Add(new DatabaseParameter("CONVERT(VARCHAR(8), WeekStart, 112)", lfromdate.ToString("yyyyMMdd"), DBDataType.String, DBLinkage.AND, DBCompareType.LargerNEqual)); KeyParameters.Add(new DatabaseParameter("CONVERT(VARCHAR(8), WeekStart, 112)", ltodate.ToString("yyyyMMdd"), DBDataType.String, DBLinkage.AND, DBCompareType.SmallerNEqual)); // delete before insert SqlHelper.DeleteCommand(KeyParameters, "tbl_ResouresPlanning"); sqlList.Add(SqlHelper.SQL); for (int col = 2; col < header.Length; col++) { for (int x = 1; x < this.FileLines.Count; x++) { string[] rowData = FileLines[x].ToString().Split(','); KeyParameters.Clear(); KeyParameters.Add(new DatabaseParameter("UserCode", rowData[0])); KeyParameters.Add(new DatabaseParameter("PrjCode", rowData[1])); KeyParameters.Add(new DatabaseParameter("PrjName", "")); KeyParameters.Add(new DatabaseParameter("WeekStart", header[col])); KeyParameters.Add(new DatabaseParameter("Hours", rowData[col])); KeyParameters.Add(new DatabaseParameter("UserImported", User.Identity.Name)); SqlHelper.InsertCommand(KeyParameters, "tbl_ResouresPlanning"); sqlList.Add(SqlHelper.SQL); } } } if (!(smooth = SqlHelper.ExecuteQuery(sqlList, Data.ConnectionString))) { StatusLabel.Text = SqlHelper.ErrMsg; } else { Response.Redirect("/TimeSheet/ResourcesPlanning.aspx?fromdate=" + lfromdate.ToString("MM/dd/yyyy") + "&todate=" + ltodate.ToString("MM/dd/yyyy")); StatusLabel.Text = "Import Resource Planning Successful."; } } return(smooth); }