private CallClosingProcess objCreateCallClosingProcess(DataRow dr)
        {
            CallClosingProcess tCallClosingProcess = new CallClosingProcess();

            tCallClosingProcess.SetObjectInfo(dr);

            return(tCallClosingProcess);
        }
        public void UpdateCallClosingProcess(CallClosingProcess argCallClosingProcess, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[19];
            param[0]  = new SqlParameter("@CallCode", argCallClosingProcess.CallCode);
            param[1]  = new SqlParameter("@CallItemNo", argCallClosingProcess.CallItemNo);
            param[2]  = new SqlParameter("@SerialNo", argCallClosingProcess.SerialNo);
            param[3]  = new SqlParameter("@MaterialCode", argCallClosingProcess.MaterialCode);
            param[4]  = new SqlParameter("@MaterialTypeCode", argCallClosingProcess.MaterialTypeCode);
            param[5]  = new SqlParameter("@MatGroup1Code", argCallClosingProcess.MatGroup1Code);
            param[6]  = new SqlParameter("@StoreCode", argCallClosingProcess.StoreCode);
            param[7]  = new SqlParameter("@MaterialDocTypeCode", argCallClosingProcess.MaterialDocTypeCode);
            param[8]  = new SqlParameter("@GoodsMovementCode", argCallClosingProcess.GoodsMovementCode);
            param[9]  = new SqlParameter("@GoodsMMItemNo", argCallClosingProcess.GoodsMMItemNo);
            param[10] = new SqlParameter("@Quantity", argCallClosingProcess.Quantity);
            param[11] = new SqlParameter("@UOMCode", argCallClosingProcess.UOMCode);
            param[12] = new SqlParameter("@PartnerCode", argCallClosingProcess.PartnerCode);
            param[13] = new SqlParameter("@ClientCode", argCallClosingProcess.ClientCode);
            param[14] = new SqlParameter("@CreatedBy", argCallClosingProcess.CreatedBy);
            param[15] = new SqlParameter("@ModifiedBy", argCallClosingProcess.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_UpdateCallClosingProcess", 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     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
        public CallClosingProcess objGetCallClosingProcess(string argCallCode, int argCallItemNo, string argSerialNo, string argClientCode)
        {
            CallClosingProcess argCallClosingProcess = new CallClosingProcess();
            DataSet            DataSetToFill         = new DataSet();

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

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

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

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

            DataSetToFill = this.GetCallClosingProcess(argCallCode, argCallItemNo, argSerialNo, argClientCode);

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

            argCallClosingProcess = this.objCreateCallClosingProcess((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argCallClosingProcess);
        }
        public ICollection <CallClosingProcess> colGetCallClosingProcess(string argCallCode, string argClientCode)
        {
            List <CallClosingProcess> lst          = new List <CallClosingProcess>();
            DataSet            DataSetToFill       = new DataSet();
            CallClosingProcess tCallClosingProcess = new CallClosingProcess();

            DataSetToFill = this.GetCallClosingProcess(argCallCode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveCallClosingProcess(CallClosingProcess argCallClosingProcess)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsCallClosingProcessExists(argCallClosingProcess.CallCode, argCallClosingProcess.CallItemNo, argCallClosingProcess.SerialNo, argCallClosingProcess.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertCallClosingProcess(argCallClosingProcess, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateCallClosingProcess(argCallClosingProcess, 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);
        }