public bool CreateOpQuotationDetail(OpQuotationDetailObj CurOpQuotationDetailObj) { bool flag = false; if (this.TryConnection()) { DatabaseParameters keys = new DatabaseParameters(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName, CurOpQuotationDetailObj.InternalID)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Description.ActualFieldName, CurOpQuotationDetailObj.Description.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailNo.ActualFieldName, CurOpQuotationDetailObj.DetailNo.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName, CurOpQuotationDetailObj.Quotation.InternalID.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Quantity.ActualFieldName, CurOpQuotationDetailObj.Quantity.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Rate.ActualFieldName, CurOpQuotationDetailObj.Rate.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Discount.ActualFieldName, CurOpQuotationDetailObj.Discount.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.PartNo.ActualFieldName, CurOpQuotationDetailObj.PartNo.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.TotalPrice.ActualFieldName, CurOpQuotationDetailObj.TotalPrice.ToString())); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpQuotationDetail.ActualTableName); if (!(flag = base.CurDBEngine.ExecuteQuery(base.CurSQLFactory.SQL))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[OpQuotationDetailManager] : CreateOpQuotationDetail : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } //DisposeObjects(); return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpQuotationDetailManager] : CreateOpQuotationDetail : " + base.ErrMsg; //DisposeObjects(); return(flag); }
public OpQuotationDetailCollection GetOpQuotationDetailByEngineerForUnifinishJobs(string EngineerID) { OpQuotationDetailCollection details = null; if (this.TryConnection()) { DatabaseParameters parameters = new DatabaseParameters(); parameters.Add(new DatabaseParameter(this.DataStructrure.StoredProcedures.GetQuotationDetailByEngineerForUnfinishJob.Param_EngineerID.ActualFieldName, EngineerID)); base.CurSQLFactory.ExecuteStoredProcedure(this.DataStructrure.StoredProcedures.GetQuotationDetailByEngineerForUnfinishJob.ActualTableName, parameters); DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL); if (table != null) { details = new OpQuotationDetailCollection(); foreach (DataRow row in table.Rows) { OpQuotationDetailObj obj2 = new OpQuotationDetailObj(row[this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName].ToString()) { Description = row[this.DataStructrure.Tables.OpQuotationDetail.Description.ActualFieldName].ToString(), DetailNo = row[this.DataStructrure.Tables.OpQuotationDetail.DetailNo.ActualFieldName].ToString(), Quantity = Convert.ToInt32(row[this.DataStructrure.Tables.OpQuotationDetail.Quantity.ActualFieldName].ToString()), Quotation = new OpQuotationObj(row[this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName].ToString()), Rate = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.Rate.ActualFieldName].ToString()), Discount = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.Discount.ActualFieldName].ToString()), Unit = row[this.DataStructrure.Tables.OpQuotationDetail.Unit.ActualFieldName].ToString(), PartNo = row[this.DataStructrure.Tables.OpQuotationDetail.PartNo.ActualFieldName].ToString(), TotalPrice = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.TotalPrice.ActualFieldName].ToString()) }; details.Add(obj2); } this.DisposeObjects(); return(details); } base.error_occured = true; base.ErrMsg = "[OpQuotationDetailManager] : GetOpQuotationDetailByQuotationID : " + base.CurDBEngine.ErrorMessage; this.DisposeObjects(); return(details); } base.error_occured = true; base.ErrMsg = "[OpQuotationDetailManager] : GetOpQuotationDetailByQuotationID : " + base.ErrMsg; this.DisposeObjects(); return(details); }
public string CreateOpQuotationDetailSQL(OpQuotationDetailObj CurOpQuotationDetailObj) { if (this.TryConnection()) { DatabaseParameters keys = new DatabaseParameters(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName, CurOpQuotationDetailObj.InternalID)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Description.ActualFieldName, CurOpQuotationDetailObj.Description.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailNo.ActualFieldName, CurOpQuotationDetailObj.DetailNo.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName, CurOpQuotationDetailObj.Quotation.InternalID.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Quantity.ActualFieldName, CurOpQuotationDetailObj.Quantity.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Rate.ActualFieldName, CurOpQuotationDetailObj.Rate.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.Discount.ActualFieldName, CurOpQuotationDetailObj.Discount.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.PartNo.ActualFieldName, CurOpQuotationDetailObj.PartNo.ToString().Replace("'", "''"), true, true)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.TotalPrice.ActualFieldName, CurOpQuotationDetailObj.TotalPrice.ToString())); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpQuotationDetail.ActualTableName); return(base.CurSQLFactory.SQL); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpQuotationDetailManager] : CreateOpQuotationDetail : " + base.ErrMsg; return(""); }
public OpQuotationDetailObj GetOpQuotationDetailByInternalID(string InternalID) { OpQuotationDetailObj obj2 = null; if (this.TryConnection()) { DatabaseParameters parameters = new DatabaseParameters(); parameters.Add(new DatabaseParameter(this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName, InternalID)); base.CurSQLFactory.SelectCommand(parameters, this.DataStructrure.Tables.OpQuotationDetail.ActualTableName); DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL); if (table != null) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; obj2 = new OpQuotationDetailObj(row[this.DataStructrure.Tables.OpQuotationDetail.InternalID.ActualFieldName].ToString()) { Description = row[this.DataStructrure.Tables.OpQuotationDetail.Description.ActualFieldName].ToString(), DetailNo = row[this.DataStructrure.Tables.OpQuotationDetail.DetailNo.ActualFieldName].ToString(), Quantity = Convert.ToInt32(row[this.DataStructrure.Tables.OpQuotationDetail.Quantity.ActualFieldName].ToString()), Quotation = new OpQuotationObj(row[this.DataStructrure.Tables.OpQuotationDetail.DetailQuotation.ActualFieldName].ToString()), Rate = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.Rate.ActualFieldName].ToString()), Discount = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.Discount.ActualFieldName].ToString()), Unit = row[this.DataStructrure.Tables.OpQuotationDetail.Unit.ActualFieldName].ToString(), PartNo = row[this.DataStructrure.Tables.OpQuotationDetail.PartNo.ActualFieldName].ToString(), TotalPrice = Convert.ToDouble(row[this.DataStructrure.Tables.OpQuotationDetail.TotalPrice.ActualFieldName].ToString()) }; } return(obj2); } base.error_occured = true; base.ErrMsg = "[OpQuotationDetailManager] : GetOpQuotationDetailByInternalID : " + base.CurDBEngine.ErrorMessage; return(obj2); } base.error_occured = true; base.ErrMsg = "[OpQuotationDetailManager] : GetOpQuotationDetailByInternalID : " + base.ErrMsg; return(obj2); }