private CallClosingDetails objCreateCallClosingDetails(DataRow dr)
        {
            CallClosingDetails tCallClosingDetails = new CallClosingDetails();

            tCallClosingDetails.SetObjectInfo(dr);

            return(tCallClosingDetails);
        }
        public void InsertCallClosingDetails(CallClosingDetails argCallClosingDetails, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[25];
            param[0]  = new SqlParameter("@CallClosingCode", argCallClosingDetails.CallClosingCode);
            param[1]  = new SqlParameter("@CallClosingDocTypeCode", argCallClosingDetails.CallClosingDocTypeCode);
            param[2]  = new SqlParameter("@CallCode", argCallClosingDetails.CallCode);
            param[3]  = new SqlParameter("@CallItemNo", argCallClosingDetails.CallItemNo);
            param[4]  = new SqlParameter("@CallClosingDate", argCallClosingDetails.CallClosingDate);
            param[5]  = new SqlParameter("@SerialNo1", argCallClosingDetails.SerialNo1);
            param[6]  = new SqlParameter("@SerialNo2", argCallClosingDetails.SerialNo2);
            param[7]  = new SqlParameter("@MaterialCode", argCallClosingDetails.MaterialCode);
            param[8]  = new SqlParameter("@MatGroup1Code", argCallClosingDetails.MatGroup1Code);
            param[9]  = new SqlParameter("@PartnerCode", argCallClosingDetails.PartnerCode);
            param[10] = new SqlParameter("@StoreCode", argCallClosingDetails.StoreCode);
            param[11] = new SqlParameter("@StockIndicator", argCallClosingDetails.StockIndicator);
            param[12] = new SqlParameter("@PartnerEmployeeCode", argCallClosingDetails.PartnerEmployeeCode);
            param[13] = new SqlParameter("@Quantity", argCallClosingDetails.Quantity);
            param[14] = new SqlParameter("@UOMCode", argCallClosingDetails.UOMCode);
            param[15] = new SqlParameter("@MaterialDocTypeCode", argCallClosingDetails.MaterialDocTypeCode);
            param[16] = new SqlParameter("@PGoodsMovementCode", argCallClosingDetails.PGoodsMovementCode);
            param[17] = new SqlParameter("@GMItemNo", argCallClosingDetails.GMItemNo);

            param[18] = new SqlParameter("@PayableAmt", argCallClosingDetails.PayableAmt);

            param[19] = new SqlParameter("@ClientCode", argCallClosingDetails.ClientCode);
            param[20] = new SqlParameter("@CreatedBy", argCallClosingDetails.CreatedBy);
            param[21] = new SqlParameter("@ModifiedBy", argCallClosingDetails.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[23].Value);
            string strType     = Convert.ToString(param[22].Value);
            string strRetValue = Convert.ToString(param[24].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 CallClosingDetails objGetCallClosingDetails(string argCallClosingCode, string argCallCode, int argCallItemNo, string argPartnerCode, string argClientCode)
        {
            CallClosingDetails argCallClosingDetails = new CallClosingDetails();
            DataSet            DataSetToFill         = new DataSet();

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

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

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

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

            DataSetToFill = this.GetCallClosingDetails(argCallClosingCode, argCallCode, argCallItemNo, argPartnerCode, argClientCode);

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

            argCallClosingDetails = this.objCreateCallClosingDetails((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argCallClosingDetails);
        }
        public void colGetCallClosingDetails(string argCallClosingCode, string argCallCode, string argPartnerCode, string argClientCode, ref CallClosingDetailCol argCallClosingDetailCol)
        {
            DataSet            DataSetToFill       = new DataSet();
            CallClosingDetails tCallClosingDetails = new CallClosingDetails();

            DataSetToFill = this.GetCallClosingDetails(argCallClosingCode, argCallCode, argPartnerCode, argClientCode);

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

Finish:
            DataSetToFill = null;
        }
        public ICollection <CallClosingDetails> colGetCallClosingDetails(string argCallClosingCode, string argCallCode, string argPartnerCode, string argClientCode)
        {
            List <CallClosingDetails> lst          = new List <CallClosingDetails>();
            DataSet            DataSetToFill       = new DataSet();
            CallClosingDetails tCallClosingDetails = new CallClosingDetails();

            DataSetToFill = this.GetCallClosingDetails(argCallClosingCode, argCallCode, argPartnerCode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveCallClosingDetails(CallClosingDetails argCallClosingDetails)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsCallClosingDetailsExists(argCallClosingDetails.CallClosingCode, argCallClosingDetails.CallCode, argCallClosingDetails.CallItemNo, argCallClosingDetails.PartnerCode, argCallClosingDetails.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertCallClosingDetails(argCallClosingDetails, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateCallClosingDetails(argCallClosingDetails, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
            }
            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);
        }