Beispiel #1
0
        public bool AddMSuppCategory(MSuppCategory msuppcategory)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@CategoryNo", msuppcategory.CategoryNo);

            cmd.Parameters.AddWithValue("@CategoryName", msuppcategory.CategoryName);

            cmd.Parameters.AddWithValue("@CategoryDesc", msuppcategory.CategoryDesc);

            cmd.Parameters.AddWithValue("@CompanyNo", msuppcategory.CompanyNo);

            cmd.Parameters.AddWithValue("@StatusNo", msuppcategory.StatusNo);

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

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

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

            sql            = "Select * from MSuppCategory where CategoryNo =" + 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)
            {
                MSuppCategory MM = new MSuppCategory();
                while (dr.Read())
                {
                    MM.CategoryNo = Convert.ToInt32(dr["CategoryNo"]);
                    if (!Convert.IsDBNull(dr["CategoryName"]))
                    {
                        MM.CategoryName = Convert.ToString(dr["CategoryName"]);
                    }
                    if (!Convert.IsDBNull(dr["CategoryDesc"]))
                    {
                        MM.CategoryDesc = Convert.ToString(dr["CategoryDesc"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["StatusNo"]))
                    {
                        MM.StatusNo = Convert.ToInt64(dr["StatusNo"]);
                    }
                    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["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MSuppCategory());
        }
Beispiel #3
0
        public bool DeleteMSuppCategory(MSuppCategory msuppcategory)
        {
            SqlCommand cmd;

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

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