public void SaveAsgTechnicianCallDetail(AsgTechnicianCallDetail argAsgTechnicianCallDetail, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsAsgTechnicianCallDetailExists(argAsgTechnicianCallDetail.AsgTechCallCode, argAsgTechnicianCallDetail.ItemNo, argAsgTechnicianCallDetail.PartnerCode, argAsgTechnicianCallDetail.ClientCode, da) == false)
         {
             InsertAsgTechnicianCallDetail(argAsgTechnicianCallDetail, da, lstErr);
         }
         else
         {
             UpdateAsgTechnicianCallDetail(argAsgTechnicianCallDetail, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         objErrorHandler.Type       = ErrorConstant.strAboartType;
         objErrorHandler.MsgId      = 0;
         objErrorHandler.Module     = ErrorConstant.strInsertModule;
         objErrorHandler.ModulePart = ErrorConstant.strDetailModule;
         objErrorHandler.Message    = ex.Message.ToString();
         objErrorHandler.RowNo      = 0;
         objErrorHandler.FieldName  = "";
         objErrorHandler.LogCode    = "";
         lstErr.Add(objErrorHandler);
     }
 }
        private AsgTechnicianCallDetail objCreateAsgTechnicianCallDetail(DataRow dr)
        {
            AsgTechnicianCallDetail tAsgTechnicianCallDetail = new AsgTechnicianCallDetail();

            tAsgTechnicianCallDetail.SetObjectInfo(dr);

            return(tAsgTechnicianCallDetail);
        }
        public AsgTechnicianCallDetail objGetAsgTechnicianCallDetail(string argAsgTechCallCode, int argItemNo, string argPartnerCode, string argClientCode)
        {
            AsgTechnicianCallDetail argAsgTechnicianCallDetail = new AsgTechnicianCallDetail();
            DataSet DataSetToFill = new DataSet();

            if (argAsgTechCallCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argItemNo <= 0)
            {
                goto ErrorHandlers;
            }

            if (argPartnerCode.Trim() == "")
            {
                goto ErrorHandlers;
            }


            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetAsgTechnicianCallDetail(argAsgTechCallCode, argItemNo, argPartnerCode, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argAsgTechnicianCallDetail = this.objCreateAsgTechnicianCallDetail((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAsgTechnicianCallDetail);
        }
        public void colGetAsgTechnicianCallDetail(string argAsgTechCallCode, string argPartnerCode, string argClientCode, ref AsgTechnicianCallDetailCol AsgTechCallDetailCol)
        {
            DataSet DataSetToFill = new DataSet();
            AsgTechnicianCallDetail tAsgTechnicianCallDetail = new AsgTechnicianCallDetail();

            DataSetToFill = this.GetAsgTechnicianCallDetail(argAsgTechCallCode, argPartnerCode, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    AsgTechCallDetailCol.colAsgTechnicianCallDetail.Add(objCreateAsgTechnicianCallDetail(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;
        }
        public void UpdateAsgTechnicianCallDetail(AsgTechnicianCallDetail argAsgTechnicianCallDetail, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[29];
            param[0]  = new SqlParameter("@AsgTechCallCode", argAsgTechnicianCallDetail.AsgTechCallCode);
            param[1]  = new SqlParameter("@ItemNo", argAsgTechnicianCallDetail.ItemNo);
            param[2]  = new SqlParameter("@SerialNo1", argAsgTechnicianCallDetail.SerialNo1);
            param[3]  = new SqlParameter("@SerialNo2", argAsgTechnicianCallDetail.SerialNo2);
            param[4]  = new SqlParameter("@MaterialCode", argAsgTechnicianCallDetail.MaterialCode);
            param[5]  = new SqlParameter("@MatGroup1Code", argAsgTechnicianCallDetail.MatGroup1Code);
            param[6]  = new SqlParameter("@StoreCode", argAsgTechnicianCallDetail.StoreCode);
            param[7]  = new SqlParameter("@StockIndicator", argAsgTechnicianCallDetail.StockIndicator);
            param[8]  = new SqlParameter("@RefDocCode", argAsgTechnicianCallDetail.RefDocCode);
            param[9]  = new SqlParameter("@RefDocItemNo", argAsgTechnicianCallDetail.RefDocItemNo);
            param[10] = new SqlParameter("@RefDocTypeCode", argAsgTechnicianCallDetail.RefDocTypeCode);
            param[11] = new SqlParameter("@Quantity", argAsgTechnicianCallDetail.Quantity);
            param[12] = new SqlParameter("@UOMCode", argAsgTechnicianCallDetail.UOMCode);
            param[13] = new SqlParameter("@PartnerCode", argAsgTechnicianCallDetail.PartnerCode);

            param[14] = new SqlParameter("@FromPartnerEmployeeCode", argAsgTechnicianCallDetail.FromPartnerEmployeeCode);

            param[15] = new SqlParameter("@ToPartnerCode", argAsgTechnicianCallDetail.ToPartnerCode);
            param[16] = new SqlParameter("@ToPartnerEmployeeCode", argAsgTechnicianCallDetail.ToPartnerEmployeeCode);
            param[17] = new SqlParameter("@ToStoreCode", argAsgTechnicianCallDetail.ToStoreCode);
            param[18] = new SqlParameter("@ToMaterialCode", argAsgTechnicianCallDetail.ToMaterialCode);
            param[19] = new SqlParameter("@ToStockIndicator", argAsgTechnicianCallDetail.ToStockIndicator);
            param[20] = new SqlParameter("@MaterialDocTypeCode", argAsgTechnicianCallDetail.MaterialDocTypeCode);

            param[21] = new SqlParameter("@PGoodsMovementCode", argAsgTechnicianCallDetail.PGoodsMovementCode);
            param[22] = new SqlParameter("@GMItemNo", argAsgTechnicianCallDetail.GMItemNo);

            param[23] = new SqlParameter("@ClientCode", argAsgTechnicianCallDetail.ClientCode);
            param[24] = new SqlParameter("@CreatedBy", argAsgTechnicianCallDetail.CreatedBy);
            param[25] = new SqlParameter("@ModifiedBy", argAsgTechnicianCallDetail.ModifiedBy);

            param[26]           = new SqlParameter("@Type", SqlDbType.Char);
            param[26].Size      = 1;
            param[26].Direction = ParameterDirection.Output;

            param[27]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[27].Size      = 255;
            param[27].Direction = ParameterDirection.Output;

            param[28]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[28].Size      = 20;
            param[28].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateAsgTechnicianCallDetail", param);


            string strMessage  = Convert.ToString(param[27].Value);
            string strType     = Convert.ToString(param[26].Value);
            string strRetValue = Convert.ToString(param[28].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 ICollection <ErrorHandler> SaveAsgTechnicianCallDetail(AsgTechnicianCallDetail argAsgTechnicianCallDetail)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsAsgTechnicianCallDetailExists(argAsgTechnicianCallDetail.AsgTechCallCode, argAsgTechnicianCallDetail.ItemNo, argAsgTechnicianCallDetail.PartnerCode, argAsgTechnicianCallDetail.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertAsgTechnicianCallDetail(argAsgTechnicianCallDetail, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateAsgTechnicianCallDetail(argAsgTechnicianCallDetail, 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);
        }