Exemple #1
0
        public bool DeleteMItemGroup(MItemGroup mitemgroup)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@ItemGroupNo", mitemgroup.ItemGroupNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mitemgroup.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Exemple #2
0
        public bool AddMItemGroup(MItemGroup mitemgroup)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@ItemGroupNo", mitemgroup.ItemGroupNo);

            cmd.Parameters.AddWithValue("@LangGroupName", mitemgroup.LanguageName);

            cmd.Parameters.AddWithValue("@ItemGroupName", mitemgroup.ItemGroupName);

            cmd.Parameters.AddWithValue("@ControlGroup", mitemgroup.ControlGroup);

            cmd.Parameters.AddWithValue("@ControlSubGroup", mitemgroup.ControlSubGroup);

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

            cmd.Parameters.AddWithValue("@UserId", mitemgroup.UserId);

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

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

            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mitemgroup.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Exemple #3
0
        public MItemGroup ModifyMStockGroupByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MItemGroup where ItemGroupNo =" + 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)
            {
                MItemGroup MM = new MItemGroup();
                while (dr.Read())
                {
                    MM.ItemGroupNo = Convert.ToInt32(dr["ItemGroupNo"]);
                    if (!Convert.IsDBNull(dr["ItemGroupName"]))
                    {
                        MM.ItemGroupName = Convert.ToString(dr["ItemGroupName"]);
                    }
                    if (!Convert.IsDBNull(dr["LangGroupName"]))
                    {
                        MM.LanguageName = Convert.ToString(dr["LangGroupName"]);
                    }
                    if (!Convert.IsDBNull(dr["ControlGroup"]))
                    {
                        MM.ControlGroup = Convert.ToInt64(dr["ControlGroup"]);
                    }
                    if (!Convert.IsDBNull(dr["ControlSubGroup"]))
                    {
                        MM.ControlSubGroup = Convert.ToInt64(dr["ControlSubGroup"]);
                    }
                    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"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MItemGroup());
        }