public void SaveAccDeterminTableDetail(AccDeterminTableDetail argAccDeterminTableDetail, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsAccDeterminTableDetailExists(argAccDeterminTableDetail.AccDMTableCode, argAccDeterminTableDetail.FieldName, argAccDeterminTableDetail.ClientCode, da) == false)
         {
             InsertAccDeterminTableDetail(argAccDeterminTableDetail, da, lstErr);
         }
         else
         {
             InsertAccDeterminTableDetail(argAccDeterminTableDetail, da, 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);
     }
 }
        private AccDeterminTableDetail objCreateAccDeterminTableDetail(DataRow dr)
        {
            AccDeterminTableDetail tAccDeterminTableDetail = new AccDeterminTableDetail();

            tAccDeterminTableDetail.SetObjectInfo(dr);

            return(tAccDeterminTableDetail);
        }
        public void InsertAccDeterminTableDetail(AccDeterminTableDetail argAccDeterminTableDetail, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[10];
            param[0] = new SqlParameter("@AccDMTableCode", argAccDeterminTableDetail.AccDMTableCode);
            param[1] = new SqlParameter("@FieldName", argAccDeterminTableDetail.FieldName);
            param[2] = new SqlParameter("@MasterTableName", argAccDeterminTableDetail.MasterTableName);
            param[3] = new SqlParameter("@MasterTableField", argAccDeterminTableDetail.MasterTableField);
            param[4] = new SqlParameter("@ClientCode", argAccDeterminTableDetail.ClientCode);
            param[5] = new SqlParameter("@CreatedBy", argAccDeterminTableDetail.CreatedBy);
            param[6] = new SqlParameter("@ModifiedBy", argAccDeterminTableDetail.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[8].Value);
            string strType     = Convert.ToString(param[7].Value);
            string strRetValue = Convert.ToString(param[9].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 AccDeterminTableDetail objGetAccDeterminTableDetail(string argAccDMTableCode, string argFieldName, string argClientCode)
        {
            AccDeterminTableDetail argAccDeterminTableDetail = new AccDeterminTableDetail();
            DataSet DataSetToFill = new DataSet();

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

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

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

            DataSetToFill = this.GetAccDeterminTableDetail(argAccDMTableCode, argFieldName, argClientCode);

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

            argAccDeterminTableDetail = this.objCreateAccDeterminTableDetail((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAccDeterminTableDetail);
        }
        public ICollection <AccDeterminTableDetail> colGetAccDeterminTableDetail(string argAccDMTableCode, string argClientCode)
        {
            List <AccDeterminTableDetail> lst = new List <AccDeterminTableDetail>();
            DataSet DataSetToFill             = new DataSet();
            AccDeterminTableDetail tAccDeterminTableDetail = new AccDeterminTableDetail();

            DataSetToFill = this.GetAccDeterminTableDetail(argAccDMTableCode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Exemple #6
0
        public ICollection <ErrorHandler> SaveAccDeterminTableMaster(AccDeterminTableMaster argAccDeterminTableMaster, DataTable dtAccDeterminTable_Detail)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();
            string strretValue         = "";

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();

                if (blnIsAccDeterminTableMasterExists(argAccDeterminTableMaster.AccDMTableCode, argAccDeterminTableMaster.ClientCode, da) == false)
                {
                    strretValue = InsertAccDeterminTableMaster(argAccDeterminTableMaster, da, lstErr);
                }
                else
                {
                    strretValue = UpdateAccDeterminTableMaster(argAccDeterminTableMaster, da, lstErr);
                }

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }

                    if (objerr.Type == "A")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

                if (strretValue != "")
                {
                    if (dtAccDeterminTable_Detail.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dtAccDeterminTable_Detail.Rows)
                        {
                            if (Convert.ToInt32(dr["IsDeleted"]) == 0)
                            {
                                AccDeterminTableDetail objAccDeterminTableDetail = new AccDeterminTableDetail();

                                objAccDeterminTableDetail.AccDMTableCode   = strretValue.Trim();
                                objAccDeterminTableDetail.FieldName        = Convert.ToString(dr["FieldName"]).Trim();
                                objAccDeterminTableDetail.MasterTableName  = Convert.ToString(dr["MasterTableName"]).Trim();
                                objAccDeterminTableDetail.MasterTableField = Convert.ToString(dr["MasterTableField"]).Trim();
                                objAccDeterminTableDetail.ClientCode       = Convert.ToString(dr["ClientCode"]).Trim();
                                objAccDeterminTableDetail.CreatedBy        = Convert.ToString(dr["CreatedBy"]).Trim();
                                objAccDeterminTableDetail.ModifiedBy       = Convert.ToString(dr["ModifiedBy"]).Trim();

                                objAccDeterminTableDetailManager.SaveAccDeterminTableDetail(objAccDeterminTableDetail, da, lstErr);
                            }
                            else
                            {
                                objAccDeterminTableDetailManager.DeleteAccDeterminTableDetail(strretValue.ToString().Trim(), Convert.ToString(dr["FieldName"]).Trim(), Convert.ToString(dr["ClientCode"]).Trim(), 1, da);
                            }
                        }

                        foreach (ErrorHandler objerr in lstErr)
                        {
                            if (objerr.Type == "E")
                            {
                                da.ROLLBACK_TRANSACTION();
                                return(lstErr);
                            }

                            if (objerr.Type == "A")
                            {
                                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);
        }