Beispiel #1
0
    public void InsertOptionBag(clsOptionBag opt, string strInsBy, string strInsDate)
    {
        SqlCommand[] command = new SqlCommand[13];
        int          j       = 1;

        command[0]             = new SqlCommand("proc_DELETE_OptionBag");
        command[0].CommandType = CommandType.StoredProcedure;

        for (j = 1; j <= 12; j++)
        {
            command[j]             = new SqlCommand("proc_Insert_OptionBag");
            command[j].CommandType = CommandType.StoredProcedure;

            //SqlParameter p_OptID = command[j].Parameters.Add("OptID", SqlDbType.Char);
            //p_OptID.Direction = ParameterDirection.Input;
            //p_OptID.Value = opt._OptID[j - 1];

            //SqlParameter p_OptName = command[j].Parameters.Add("OptName", SqlDbType.VarChar);
            //p_OptName.Direction = ParameterDirection.Input;
            //p_OptName.Value = opt._OptName[j - 1];

            //SqlParameter p_OptValue = command[j].Parameters.Add("OptValue", SqlDbType.VarChar);
            //p_OptValue.Direction = ParameterDirection.Input;
            //p_OptValue.Value = opt._OptValue[j - 1];

            SqlParameter p_InsertedBy = command[j].Parameters.Add("InsertedBy", SqlDbType.VarChar);
            p_InsertedBy.Direction = ParameterDirection.Input;
            p_InsertedBy.Value     = strInsBy;

            SqlParameter p_InsertedDate = command[j].Parameters.Add("InsertedDate", SqlDbType.DateTime);
            p_InsertedDate.Direction = ParameterDirection.Input;
            p_InsertedDate.Value     = strInsDate;
        }
        try
        {
            objDC.MakeTransaction(command);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            command = null;
        }
    }
Beispiel #2
0
    //Insert or Update  or Delete Data of Location table

    public void InsertOptionBag(clsOptionBag opt)
    {
        SqlCommand command = new SqlCommand("proc_Insert_OptionBag");

        command.CommandType = CommandType.StoredProcedure;

        SqlParameter p_SbuId = command.Parameters.Add("SbuId", SqlDbType.BigInt);

        p_SbuId.Direction = ParameterDirection.Input;
        p_SbuId.Value     = opt.SbuId;

        SqlParameter p_OptID = command.Parameters.Add("OptID", SqlDbType.Char);

        p_OptID.Direction = ParameterDirection.Input;
        p_OptID.Value     = opt.OptID;

        SqlParameter p_OptOThour3Rate = command.Parameters.Add("OptOThour3Rate", SqlDbType.Decimal);

        p_OptOThour3Rate.Direction = ParameterDirection.Input;
        p_OptOThour3Rate.Value     = opt.OptOThour3Rate;

        SqlParameter p_OptOThour4Rate = command.Parameters.Add("OptOThour4Rate", SqlDbType.Decimal);

        p_OptOThour4Rate.Direction = ParameterDirection.Input;
        p_OptOThour4Rate.Value     = opt.OptOThour4Rate;

        SqlParameter p_OptOThour6Rate = command.Parameters.Add("OptOThour6Rate", SqlDbType.Decimal);

        p_OptOThour6Rate.Direction = ParameterDirection.Input;
        p_OptOThour6Rate.Value     = opt.OptOThour6Rate;

        SqlParameter p_OptOThour3RateHoli = command.Parameters.Add("OptOThour3RateHoli", SqlDbType.Decimal);

        p_OptOThour3RateHoli.Direction = ParameterDirection.Input;
        if (opt.OptOThour3RateHoli != "")
        {
            p_OptOThour3RateHoli.Value = opt.OptOThour3RateHoli;
        }
        else
        {
            p_OptOThour3RateHoli.Value = 0;
        }

        SqlParameter p_OptOThour4RateHoli = command.Parameters.Add("OptOThour4RateHoli", SqlDbType.Decimal);

        p_OptOThour4RateHoli.Direction = ParameterDirection.Input;
        if (opt.OptOThour4RateHoli != "")
        {
            p_OptOThour4RateHoli.Value = opt.OptOThour4RateHoli;
        }
        else
        {
            p_OptOThour4RateHoli.Value = 0;
        }

        SqlParameter p_OptOThour6RateHoli = command.Parameters.Add("OptOThour6RateHoli", SqlDbType.Decimal);

        p_OptOThour6RateHoli.Direction = ParameterDirection.Input;
        if (opt.OptOThour6RateHoli != "")
        {
            p_OptOThour6RateHoli.Value = opt.OptOThour6RateHoli;
        }
        else
        {
            p_OptOThour6RateHoli.Value = 0;
        }

        SqlParameter p_BreakFastTK = command.Parameters.Add("BreakFastTK", SqlDbType.Decimal);

        p_BreakFastTK.Direction = ParameterDirection.Input;
        p_BreakFastTK.Value     = opt.BreakFastTK;

        SqlParameter p_LunchTK = command.Parameters.Add("LunchTK", SqlDbType.Decimal);

        p_LunchTK.Direction = ParameterDirection.Input;
        p_LunchTK.Value     = opt.LunchTK;

        try
        {
            objDC.ExecuteQuery(command);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            command = null;
        }
    }