public void SaveReplacementOrderDetail(ReplacementOrderDetail argReplacementOrderDetail, DataAccess da, List <ErrorHandler> lstErr) { try { if (blnIsReplacementOrderDetailExists(argReplacementOrderDetail.RepOrderCode, argReplacementOrderDetail.RepOrderItemNo, argReplacementOrderDetail.ClientCode, da) == false) { InsertReplacementOrderDetail(argReplacementOrderDetail, da, lstErr); } else { UpdateReplacementOrderDetail(argReplacementOrderDetail, da, lstErr); } } catch (Exception ex) { objErrorHandler.Type = ErrorConstant.strAboartType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = ex.Message.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); } }
private ReplacementOrderDetail objCreateReplacementOrderDetail(DataRow dr) { ReplacementOrderDetail tReplacementOrderDetail = new ReplacementOrderDetail(); tReplacementOrderDetail.SetObjectInfo(dr); return(tReplacementOrderDetail); }
public void UpdateReplacementOrderDetail(ReplacementOrderDetail argReplacementOrderDetail, DataAccess da, List <ErrorHandler> lstErr) { SqlParameter[] param = new SqlParameter[19]; param[0] = new SqlParameter("@RepOrderCode", argReplacementOrderDetail.RepOrderCode); param[1] = new SqlParameter("@RepOrderItemNo", argReplacementOrderDetail.RepOrderItemNo); param[2] = new SqlParameter("@MaterialCode", argReplacementOrderDetail.MaterialCode); param[3] = new SqlParameter("@MatGroup1Code", argReplacementOrderDetail.MatGroup1Code); param[4] = new SqlParameter("@PartnerCode", argReplacementOrderDetail.PartnerCode); param[5] = new SqlParameter("@PartnerEmployeeCode", argReplacementOrderDetail.PartnerEmployeeCode); param[6] = new SqlParameter("@OrderQty", argReplacementOrderDetail.OrderQty); param[7] = new SqlParameter("@UOMCode", argReplacementOrderDetail.UOMCode); param[8] = new SqlParameter("@ReceivedQty", argReplacementOrderDetail.ReceivedQty); param[9] = new SqlParameter("@RepOrderStatus", argReplacementOrderDetail.RepOrderStatus); param[10] = new SqlParameter("@IssueDocCode", argReplacementOrderDetail.IssueDocCode); param[11] = new SqlParameter("@IssueDocItemNo", argReplacementOrderDetail.IssueDocItemNo); param[12] = new SqlParameter("@ToPartnerCode", argReplacementOrderDetail.ToPartnerCode); param[13] = new SqlParameter("@ClientCode", argReplacementOrderDetail.ClientCode); param[14] = new SqlParameter("@CreatedBy", argReplacementOrderDetail.CreatedBy); param[15] = new SqlParameter("@ModifiedBy", argReplacementOrderDetail.ModifiedBy); param[16] = new SqlParameter("@Type", SqlDbType.Char); param[16].Size = 1; param[16].Direction = ParameterDirection.Output; param[17] = new SqlParameter("@Message", SqlDbType.VarChar); param[17].Size = 255; param[17].Direction = ParameterDirection.Output; param[18] = new SqlParameter("@returnvalue", SqlDbType.VarChar); param[18].Size = 20; param[18].Direction = ParameterDirection.Output; int i = da.NExecuteNonQuery("Proc_UpdateReplacementOrderDetail", param); string strMessage = Convert.ToString(param[17].Value); string strType = Convert.ToString(param[16].Value); string strRetValue = Convert.ToString(param[18].Value); objErrorHandler.Type = strType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = strMessage.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); }
public ReplacementOrderDetail objGetReplacementOrderDetail(string argRepOrderCode, int argRepOrderItemNo, string argClientCode) { ReplacementOrderDetail argReplacementOrderDetail = new ReplacementOrderDetail(); DataSet DataSetToFill = new DataSet(); if (argRepOrderCode.Trim() == "") { goto ErrorHandlers; } if (argRepOrderItemNo <= 0) { goto ErrorHandlers; } if (argClientCode.Trim() == "") { goto ErrorHandlers; } DataSetToFill = this.GetReplacementOrderDetail(argRepOrderCode, argRepOrderItemNo, argClientCode); if (DataSetToFill.Tables[0].Rows.Count <= 0) { goto Finish; } argReplacementOrderDetail = this.objCreateReplacementOrderDetail((DataRow)DataSetToFill.Tables[0].Rows[0]); goto Finish; ErrorHandlers: Finish: DataSetToFill = null; return(argReplacementOrderDetail); }
public ICollection <ReplacementOrderDetail> colGetReplacementOrderDetail(string argRepOrderCode, string argClientCode) { List <ReplacementOrderDetail> lst = new List <ReplacementOrderDetail>(); DataSet DataSetToFill = new DataSet(); ReplacementOrderDetail tReplacementOrderDetail = new ReplacementOrderDetail(); DataSetToFill = this.GetReplacementOrderDetail(argRepOrderCode, argClientCode); if (DataSetToFill != null) { foreach (DataRow dr in DataSetToFill.Tables[0].Rows) { lst.Add(objCreateReplacementOrderDetail(dr)); } } goto Finish; Finish: DataSetToFill = null; return(lst); }
public PartnerErrorResult SavePartnerGoodsMovement(PartnerGoodsMovement argPartnerGoodsMovement, PartnerGoodsMovementDetailCol argPartnerGNDetail, PartnerGoodsMovSerialDetailCol argPartnerGMSerialDetail) { List <ErrorHandler> lstErr = new List <ErrorHandler>(); PartnerErrorResult errorcol = new PartnerErrorResult(); PartnerGoodsMovementDetailManager objPartnerGMDetailManager = new PartnerGoodsMovementDetailManager(); PartnerGoodsMovSerialDetailManager objPartnerGNSerialDetailManager = new PartnerGoodsMovSerialDetailManager(); DataAccess da = new DataAccess(); string strRetValue = ""; try { da.Open_Connection(); da.BEGIN_TRANSACTION(); if (blnIsPartnerGoodsMovementExists(argPartnerGoodsMovement.PGoodsMovementCode, argPartnerGoodsMovement.ClientCode, da) == false) { strRetValue = InsertPartnerGoodsMovement(argPartnerGoodsMovement, da, lstErr); } else { strRetValue = UpdatePartnerGoodsMovement(argPartnerGoodsMovement, da, lstErr); } foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } if (objerr.Type == "A") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } } if (strRetValue != "") { if (argPartnerGNDetail.colPartnerGMDetail.Count > 0) { foreach (PartnerGoodsMovementDetail objPartnerGMDetail in argPartnerGNDetail.colPartnerGMDetail) { objPartnerGMDetail.PGoodsMovementCode = strRetValue; if (objPartnerGMDetail.IsDeleted == 0) { objPartnerGMDetailManager.SavePartnerGoodsMovementDetail(objPartnerGMDetail, da, lstErr); } else { /*Delete Function Call*/ } } foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } if (objerr.Type == "A") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } } } if (argPartnerGMSerialDetail.colPartnerGMSerialDetail.Count > 0) { foreach (PartnerGoodsMovSerialDetail objPartnerGMSerialDetail in argPartnerGMSerialDetail.colPartnerGMSerialDetail) { objPartnerGMSerialDetail.PGoodsMovementCode = strRetValue; if (objPartnerGMSerialDetail.IsDeleted == 0) { objPartnerGNSerialDetailManager.SavePartnerGoodsMovSerialDetail(objPartnerGMSerialDetail, da, lstErr); } else { /*Call delete function*/ } } foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } if (objerr.Type == "A") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } } } /******************************/ int IsCreateRepOrder = 0; PartnerGMDocTypeManager objPartnerGMDocTypeMan = new PartnerGMDocTypeManager(); DataSet ds = objPartnerGMDocTypeMan.GetPartnerGMDocType(Convert.ToString(argPartnerGoodsMovement.PartnerGMDocTypeCode), Convert.ToString(argPartnerGoodsMovement.ClientCode), da); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { if (Convert.ToString(ds.Tables[0].Rows[0]["CreateRepOrder"]) != "") { IsCreateRepOrder = Convert.ToInt32(ds.Tables[0].Rows[0]["CreateRepOrder"]); } } } if (IsCreateRepOrder == 1) { ///* Call Replace Order Save Function */ ReplacementOrder objRepalcementOrder = new ReplacementOrder(); string strNewRepOrderCode = objReplaceOrderManager.GenerateRepOrderCode("NEW", "RO01", argPartnerGoodsMovement.PartnerCode, argPartnerGoodsMovement.ClientCode); objRepalcementOrder.RepOrderCode = strNewRepOrderCode; objRepalcementOrder.RepOrderDocTypeCode = Convert.ToString("RO01"); objRepalcementOrder.RepOrderDate = Convert.ToDateTime(argPartnerGoodsMovement.GoodsMovDate).ToString("yyyy-MM-dd"); objRepalcementOrder.TotalQuantity = 0; objRepalcementOrder.RepOrderStatus = "OPEN"; objRepalcementOrder.OrderType = Convert.ToString(argPartnerGoodsMovement.AssignType); objRepalcementOrder.IssueDocCode = Convert.ToString(argPartnerGoodsMovement.PGoodsMovementCode); objRepalcementOrder.PartnerCode = Convert.ToString(argPartnerGoodsMovement.PartnerCode); objRepalcementOrder.ToPartnerCode = Convert.ToString(argPartnerGoodsMovement.ToPartnerCode); objRepalcementOrder.ClientCode = Convert.ToString(argPartnerGoodsMovement.ClientCode); objRepalcementOrder.CreatedBy = Convert.ToString(argPartnerGoodsMovement.CreatedBy); objRepalcementOrder.ModifiedBy = Convert.ToString(argPartnerGoodsMovement.ModifiedBy); ReplacementOrderDetailCol argReplacementOrderDetailCol = new ReplacementOrderDetailCol(); ReplacementOrderDetail objReplacementOrderDetail = null; ReplacementOrderSerialDetailCol argReplacementOrderSerialDetailCol = new ReplacementOrderSerialDetailCol(); ReplacementOrderSerialDetail objReplacementOrderSerialDetail = null; int ictr = 0; foreach (PartnerGoodsMovementDetail objPartnerGMDetail in argPartnerGNDetail.colPartnerGMDetail) { ictr = ictr + 1; objReplacementOrderDetail = new ReplacementOrderDetail(); objReplacementOrderDetail.RepOrderCode = strNewRepOrderCode; objReplacementOrderDetail.RepOrderItemNo = ictr; objReplacementOrderDetail.MaterialCode = objPartnerGMDetail.MaterialCode; objReplacementOrderDetail.MatGroup1Code = objPartnerGMDetail.MatGroup1Code; objReplacementOrderDetail.PartnerCode = objPartnerGMDetail.PartnerCode; objReplacementOrderDetail.PartnerEmployeeCode = objPartnerGMDetail.FromPartnerEmployeeCode; objReplacementOrderDetail.OrderQty = objPartnerGMDetail.Quantity; objReplacementOrderDetail.UOMCode = objPartnerGMDetail.UOMCode; objReplacementOrderDetail.ReceivedQty = 0; objReplacementOrderDetail.RepOrderStatus = "OPEN"; objReplacementOrderDetail.IssueDocCode = objPartnerGMDetail.PGoodsMovementCode; objReplacementOrderDetail.IssueDocItemNo = objPartnerGMDetail.ItemNo; objReplacementOrderDetail.ToPartnerCode = objPartnerGMDetail.ToPartnerCode; objReplacementOrderDetail.ClientCode = argPartnerGoodsMovement.ClientCode; objReplacementOrderDetail.CreatedBy = argPartnerGoodsMovement.CreatedBy; objReplacementOrderDetail.ModifiedBy = argPartnerGoodsMovement.ModifiedBy; objReplacementOrderDetail.IsDeleted = 0; argReplacementOrderDetailCol.colReplacementOrderDetail.Add(objReplacementOrderDetail); foreach (PartnerGoodsMovSerialDetail objPartnerGMSerialDetail in argPartnerGMSerialDetail.colPartnerGMSerialDetail) { if (objPartnerGMSerialDetail.ItemNo == objPartnerGMDetail.ItemNo) { objReplacementOrderSerialDetail = new ReplacementOrderSerialDetail(); objReplacementOrderSerialDetail.RepOrderCode = strNewRepOrderCode; objReplacementOrderSerialDetail.RepOrderItemNo = ictr; objReplacementOrderSerialDetail.SerialNo1 = objPartnerGMSerialDetail.SerialNo1; objReplacementOrderSerialDetail.SerialNo2 = objPartnerGMSerialDetail.SerialNo2; objReplacementOrderSerialDetail.MaterialCode = objPartnerGMSerialDetail.MaterialCode; objReplacementOrderSerialDetail.MatGroup1Code = objPartnerGMSerialDetail.MatGroup1Code; objReplacementOrderSerialDetail.PartnerCode = objPartnerGMSerialDetail.PartnerCode; objReplacementOrderSerialDetail.PartnerEmployeeCode = objPartnerGMSerialDetail.PartnerEmployeeCode; objReplacementOrderSerialDetail.OrderQty = 1; objReplacementOrderSerialDetail.UOMCode = objPartnerGMDetail.UOMCode; objReplacementOrderSerialDetail.ReceivedQty = 0; objReplacementOrderSerialDetail.RepOrderStatus = "OPEN"; objReplacementOrderSerialDetail.IssueDocCode = objPartnerGMSerialDetail.PGoodsMovementCode; objReplacementOrderSerialDetail.IssueDocItemNo = objPartnerGMSerialDetail.ItemNo; objReplacementOrderSerialDetail.ToPartnerCode = objPartnerGMSerialDetail.ToPartnerCode; objReplacementOrderSerialDetail.ClientCode = argPartnerGoodsMovement.ClientCode; objReplacementOrderSerialDetail.CreatedBy = argPartnerGoodsMovement.CreatedBy; objReplacementOrderSerialDetail.ModifiedBy = argPartnerGoodsMovement.ModifiedBy; objReplacementOrderSerialDetail.IsDeleted = 0; argReplacementOrderSerialDetailCol.colReplacementOrderSerialDetail.Add(objReplacementOrderSerialDetail); } } } if (argReplacementOrderDetailCol.colReplacementOrderDetail.Count > 0) { objReplaceOrderManager.SaveReplacementOrder(objRepalcementOrder, argReplacementOrderDetailCol, argReplacementOrderSerialDetailCol, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } if (objerr.Type == "A") { errorcol.colErrorHandler.Add(objerr); da.ROLLBACK_TRANSACTION(); return(errorcol); } } } } /******************************/ } da.COMMIT_TRANSACTION(); } catch (Exception ex) { if (da != null) { da.ROLLBACK_TRANSACTION(); } objErrorHandler.Type = ErrorConstant.strAboartType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = ex.Message.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); errorcol.colErrorHandler.Add(objErrorHandler); } finally { if (da != null) { da.Close_Connection(); da = null; } } return(errorcol); }
public ICollection <ErrorHandler> SaveReplacementOrderDetail(ReplacementOrderDetail argReplacementOrderDetail) { List <ErrorHandler> lstErr = new List <ErrorHandler>(); DataAccess da = new DataAccess(); try { if (blnIsReplacementOrderDetailExists(argReplacementOrderDetail.RepOrderCode, argReplacementOrderDetail.RepOrderItemNo, argReplacementOrderDetail.ClientCode) == false) { da.Open_Connection(); da.BEGIN_TRANSACTION(); InsertReplacementOrderDetail(argReplacementOrderDetail, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } } else { da.Open_Connection(); da.BEGIN_TRANSACTION(); UpdateReplacementOrderDetail(argReplacementOrderDetail, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } } da.COMMIT_TRANSACTION(); } catch (Exception ex) { if (da != null) { da.ROLLBACK_TRANSACTION(); } objErrorHandler.Type = ErrorConstant.strAboartType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = ex.Message.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); } finally { if (da != null) { da.Close_Connection(); da = null; } } return(lstErr); }