Ejemplo n.º 1
0
        public static Actm Read(string connectionString, string acc_no, Dber dberr)
        {
            try
            {
                var accountMasterObject = new Actm();

                var query = string.Format("select * from actm where ac_no = {0}", acc_no);
                var data = DbAccess.ExecuteQuery(connectionString, CommandType.Text, query);

                //assign the data object to account master object
                if (data.Tables[0].Rows.Count > 0)
                {
                    accountMasterObject.ac_bal = Convert.ToDecimal(data.Tables[0].Rows[0]["ac_bal"]);
                    accountMasterObject.ac_cr_flag = data.Tables[0].Rows[0]["ac_cr_flag"].ToString();
                    accountMasterObject.ac_dr_flag = data.Tables[0].Rows[0]["ac_dr_flag"].ToString();
                    accountMasterObject.ac_hold = Convert.ToDecimal(data.Tables[0].Rows[0]["ac_hold"]);
                    accountMasterObject.ac_no = data.Tables[0].Rows[0]["ac_no"].ToString();
                    accountMasterObject.ac_open_dt = data.Tables[0].Rows[0]["ac_open_dt"].ToString();
                    accountMasterObject.ac_pvg = Convert.ToInt32(data.Tables[0].Rows[0]["ac_pvg"]);
                    accountMasterObject.ac_type = data.Tables[0].Rows[0]["ac_type"].ToString();
                    accountMasterObject.cs_no1 = data.Tables[0].Rows[0]["cs_no1"].ToString();
                    accountMasterObject.cs_no2 = data.Tables[0].Rows[0]["cs_no2"].ToString();
                    accountMasterObject.ac_activ = Convert.ToBoolean(data.Tables[0].Rows[0]["ac_activ"].ToString());

                    return accountMasterObject;
                }
                else
                {
                    dberr.setError(Mnemonics.DbErrorCodes.DBERR_ACTM_NOFIND);
                    return null; 
                }
            }
            catch(Exception ex)
            {
                dberr.setError(Mnemonics.DbErrorCodes.DBERR_ACTM_NOFIND);
                return null;
            }
        }
Ejemplo n.º 2
0
 public static int Create(string connectionString, Actm dataObject, Dber dberr)
 {
     try
     {
         if (dataObject.cs_no2.Trim() == string.Empty) dataObject.cs_no2 = null;
         var query = string.Format(@"INSERT INTO [SBS].[dbo].[ACTM]
                    ([CS_NO1],[CS_NO2],[AC_TYPE],[AC_BAL],[AC_HOLD],[AC_PVG],[AC_DR_FLAG],[AC_CR_FLAG],[AC_OPEN_DT],[AC_ACTIV])
                     OUTPUT INSERTED.AC_NO                            
                     VALUES
                    ({0},{1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')",
                     dataObject.cs_no1, dataObject.cs_no2 == "0" ? "null" :dataObject.cs_no2, dataObject.ac_type, dataObject.ac_bal, dataObject.ac_hold,
                     dataObject.ac_pvg, dataObject.ac_dr_flag, dataObject.ac_cr_flag, dataObject.ac_open_dt, dataObject.ac_activ);
         return (int)DbAccess.ExecuteScalar(connectionString, CommandType.Text, query);
     }
     catch (Exception ex)
     {
         dberr.setError(Mnemonics.DbErrorCodes.DBERR_ACTM_CREATE);
         return -1;
     }
 }
Ejemplo n.º 3
0
        public static bool Update(Actm actmObject, Dber dberr)
        {
            throw new NotImplementedException();
            try
            {
                var query = "";

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }