public bool AddMBarcodePrefix(MBarcodePrefix mbarcodeprefix)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkPrefixBarcodeNo", mbarcodeprefix.PkPrefixBarcodeNo);
            cmd.Parameters.AddWithValue("@PrefixBarcode", mbarcodeprefix.PrefixBarcode);
            cmd.Parameters.AddWithValue("@MainGroupNo", mbarcodeprefix.MainGroupNo);
            cmd.Parameters.AddWithValue("@BrandNo", mbarcodeprefix.BrandNo);
            cmd.Parameters.AddWithValue("@CompanyNo", mbarcodeprefix.CompanyNo);
            cmd.Parameters.AddWithValue("@DepartmentNo", mbarcodeprefix.DepartmentNo);
            cmd.Parameters.AddWithValue("@CategoryNo", mbarcodeprefix.CategoryNo);
            cmd.Parameters.AddWithValue("@SalesTaxSettingNo", mbarcodeprefix.SalesTaxSettingNo);
            cmd.Parameters.AddWithValue("@PurchaseTaxSettingNo", mbarcodeprefix.PurchaseTaxSettingNo);
            cmd.Parameters.AddWithValue("@IsActive", mbarcodeprefix.IsActive);

            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool DeleteBarcodePrefix(MBarcodePrefix mbarcodeprefix)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkPrefixBarcodeNo", mbarcodeprefix.PkPrefixBarcodeNo);

            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public MBarcodePrefix ModifyBarcodePrefixByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MBarcodePrefix where PkPrefixBarcodeNo =" + 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)
            {
                MBarcodePrefix MM = new MBarcodePrefix();
                while (dr.Read())
                {
                    MM.PkPrefixBarcodeNo = Convert.ToInt32(dr["PkPrefixBarcodeNo"]);
                    if (!Convert.IsDBNull(dr["PrefixBarcode"]))
                    {
                        MM.PrefixBarcode = Convert.ToString(dr["PrefixBarcode"]);
                    }
                    if (!Convert.IsDBNull(dr["MainGroupNo"]))
                    {
                        MM.MainGroupNo = Convert.ToInt64(dr["MainGroupNo"]);
                    }
                    if (!Convert.IsDBNull(dr["BrandNo"]))
                    {
                        MM.BrandNo = Convert.ToInt64(dr["BrandNo"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["DepartmentNo"]))
                    {
                        MM.DepartmentNo = Convert.ToInt64(dr["DepartmentNo"]);
                    }
                    if (!Convert.IsDBNull(dr["CategoryNo"]))
                    {
                        MM.CategoryNo = Convert.ToInt64(dr["CategoryNo"]);
                    }
                    if (!Convert.IsDBNull(dr["SalesTaxSettingNo"]))
                    {
                        MM.SalesTaxSettingNo = Convert.ToInt64(dr["SalesTaxSettingNo"]);
                    }
                    if (!Convert.IsDBNull(dr["PurchaseTaxSettingNo"]))
                    {
                        MM.PurchaseTaxSettingNo = Convert.ToInt64(dr["PurchaseTaxSettingNo"]);
                    }
                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToBoolean(dr["IsActive"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MBarcodePrefix());
        }