Beispiel #1
0
        public bool AddMBank(MBank mbank)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddMBank";

            cmd.Parameters.AddWithValue("@BankNo", mbank.BankNo);

            cmd.Parameters.AddWithValue("@BankName", mbank.BankName);

            //cmd.Parameters.AddWithValue("@ShortCode", mbank.ShortCode);

            cmd.Parameters.AddWithValue("@IsActive", mbank.IsActive);

            cmd.Parameters.AddWithValue("@UserID", mbank.UserID);

            cmd.Parameters.AddWithValue("@UserDate", mbank.UserDate);

            cmd.Parameters.AddWithValue("@CompanyNo", mbank.CompanyNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mbank.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Beispiel #2
0
        public MBank ModifyMOtherBankByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MBank where BankNo =" + ID;
            cmd            = new SqlCommand(sql, Con);
            cmd.Connection = Con;
            Con.Open();
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr;

            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (dr.HasRows)
            {
                MBank MM = new MBank();
                while (dr.Read())
                {
                    MM.BankNo = Convert.ToInt32(dr["BankNo"]);
                    if (!Convert.IsDBNull(dr["BankName"]))
                    {
                        MM.BankName = Convert.ToString(dr["BankName"]);
                    }

                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToBoolean(dr["IsActive"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MBank());
        }
Beispiel #3
0
        public bool DeleteMBank(MBank mbank)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteMBank";

            cmd.Parameters.AddWithValue("@BankNo", mbank.BankNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mbank.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }