private CallTypeDetail objCreateCallTypeDetail(DataRow dr)
        {
            CallTypeDetail tCallTypeDetail = new CallTypeDetail();

            tCallTypeDetail.SetObjectInfo(dr);

            return(tCallTypeDetail);
        }
        public void UpdateCallTypeDetail(CallTypeDetail argCallTypeDetail, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[9];
            param[0] = new SqlParameter("@CallTypeCode", argCallTypeDetail.CallTypeCode);
            param[1] = new SqlParameter("@ItemNo", argCallTypeDetail.ItemNo);
            param[2] = new SqlParameter("@MaterialTypeCode", argCallTypeDetail.MaterialTypeCode);
            param[3] = new SqlParameter("@ClientCode", argCallTypeDetail.ClientCode);
            param[4] = new SqlParameter("@CreatedBy", argCallTypeDetail.CreatedBy);
            param[5] = new SqlParameter("@ModifiedBy", argCallTypeDetail.ModifiedBy);


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

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

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

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


            string strMessage  = Convert.ToString(param[7].Value);
            string strType     = Convert.ToString(param[6].Value);
            string strRetValue = Convert.ToString(param[8].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 CallTypeDetail objGetCallTypeDetail(string argCallTypeCode, int argItemNo, string argClientCode)
        {
            CallTypeDetail argCallTypeDetail = new CallTypeDetail();
            DataSet        DataSetToFill     = new DataSet();

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

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

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

            DataSetToFill = this.GetCallTypeDetail(argCallTypeCode, argItemNo, argClientCode);

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

            argCallTypeDetail = this.objCreateCallTypeDetail((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argCallTypeDetail);
        }
        public ICollection <CallTypeDetail> colGetCallTypeDetail(string argCallTypeCode, string argClientCode)
        {
            List <CallTypeDetail> lst      = new List <CallTypeDetail>();
            DataSet        DataSetToFill   = new DataSet();
            CallTypeDetail tCallTypeDetail = new CallTypeDetail();

            DataSetToFill = this.GetCallTypeDetail(argCallTypeCode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveCallTypeDetail(CallTypeDetail argCallTypeDetail)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsCallTypeDetailExists(argCallTypeDetail.CallTypeCode, argCallTypeDetail.ItemNo, argCallTypeDetail.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertCallTypeDetail(argCallTypeDetail, 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();
                    UpdateCallTypeDetail(argCallTypeDetail, 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);
        }