示例#1
0
        /// <summary>
        /// Saves the Range.
        /// </summary>
        /// <returns>Range object</returns>
        public Range SaveRange()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Range";

                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeID", SqlDbType.Int, RangeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeName", SqlDbType.VarChar, RangeName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BeginSquare", SqlDbType.Int, BeginSquare.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EndSquare", SqlDbType.Int, EndSquare.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Modifier", SqlDbType.Int, ModifierID.ToString(), 0));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
示例#2
0
        /// <summary>
        /// Deletes the Weapon Range item.
        /// </summary>
        /// <param name="WeaponID">The weapon identifier.</param>
        /// <returns>Boolean</returns>
        public bool DeleteWeaponRange(int WeaponID)
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Delete_WeaponRange";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeID", SqlDbType.Int, RangeID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }
示例#3
0
    protected void DataGrid1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow Row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;

        if (e.CommandName.ToString().Trim() == "Sort")
        {
            return;
        }

        int RangeID;

        try
        {
            RangeID = Convert.ToInt32(Row.Cells[0].Text);
        }
        catch
        {
            RangeID = 0;
        }

        int BeginCard;

        try
        {
            BeginCard = Convert.ToInt32(Row.Cells[4].Text);
        }
        catch
        {
            BeginCard = 0;
        }

        int EndCard;

        try
        {
            EndCard = Convert.ToInt32(Row.Cells[5].Text);
        }
        catch
        {
            EndCard = 0;
        }

        string ToStoreID = ((TextBox)Row.FindControl("txt_ToStore")).Text.Trim();
        int    count1    = VIPCardManageBll.BetweenCard(Convert.ToInt32(BeginCard.ToString()), Convert.ToInt32(EndCard.ToString()));

        switch (e.CommandName.Trim())
        {
        case "DELETE":
            if (count1 > 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001578", "该卡号段中的一些卡号已分配到会员,不能取消分配"));
                return;
            }
            VIPCardManageBll.Uptvipcard(Convert.ToInt32(RangeID.ToString().Trim()));
            ScriptHelper.SetAlert(Page, GetTran("001577", "卡号范围“") + RangeID.ToString() + GetTran("001576", "”取消分配成功!"));
            break;

        case "UPDATE":
            if (count1 > 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001573", "该卡号段中的一些卡号已分配到会员,不能重新分配"));
                return;
            }
            int count2 = VIPCardManageBll.valiStore(ToStoreID);
            if (count2 == 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001571", "店铺“") + ToStoreID + GetTran("001569", "”不存在,不能将卡号范围重分配到该店铺"));
                return;
            }
            VIPCardManageBll.Uptvipcardstore(Convert.ToInt32(ToStoreID), RangeID.ToString().Trim());
            ScriptHelper.SetAlert(Page, GetTran("001568", "卡号范围“") + RangeID.ToString() + GetTran("001565", "”重分配到店铺“") + ToStoreID + GetTran("001563", "”成功!"));
            break;
        }
        btn_Query_Click1(null, null);
    }