public bool DeleteMItemTaxSetting(MItemTaxSetting mitemtaxsetting)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkSrNo", mitemtaxsetting.PkSrNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mitemtaxsetting.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
        public bool AddMItemTaxSetting(MItemTaxSetting mitemtaxsetting)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@PkSrNo", mitemtaxsetting.PkSrNo);

            cmd.Parameters.AddWithValue("@TaxSettingName", mitemtaxsetting.TaxSettingName);

            cmd.Parameters.AddWithValue("@TaxLedgerNo", mitemtaxsetting.TaxLedgerNo);

            cmd.Parameters.AddWithValue("@SalesLedgerNo", mitemtaxsetting.SalesLedgerNo);

            cmd.Parameters.AddWithValue("@CalculationMethod", mitemtaxsetting.CalculationMethod);

            cmd.Parameters.AddWithValue("@Percentage", mitemtaxsetting.Percentage);

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

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

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

            cmd.Parameters.AddWithValue("@UserDate", mitemtaxsetting.UserDate);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mitemtaxsetting.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
        public MItemTaxSetting ModifyMItemTaxSettingByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MItemTaxSetting where PkSrNo =" + 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)
            {
                MItemTaxSetting MM = new MItemTaxSetting();
                while (dr.Read())
                {
                    MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]);
                    if (!Convert.IsDBNull(dr["TaxSettingName"]))
                    {
                        MM.TaxSettingName = Convert.ToString(dr["TaxSettingName"]);
                    }
                    if (!Convert.IsDBNull(dr["TaxLedgerNo"]))
                    {
                        MM.TaxLedgerNo = Convert.ToInt64(dr["TaxLedgerNo"]);
                    }
                    if (!Convert.IsDBNull(dr["SalesLedgerNo"]))
                    {
                        MM.SalesLedgerNo = Convert.ToInt64(dr["SalesLedgerNo"]);
                    }
                    //if (!Convert.IsDBNull(dr["CalculationMethod"])) MM.CalculationMethod = Convert.ToString(dr["CalculationMethod"]);
                    if (!Convert.IsDBNull(dr["Percentage"]))
                    {
                        MM.Percentage = Convert.ToDouble(dr["Percentage"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    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"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MItemTaxSetting());
        }