Ejemplo n.º 1
0
    override protected Boolean LoadData()
    {
        try
        {
            // Load Data For Page.
            DAWebConfig daWebConfig = new DAWebConfig();
            daWebConfig.USP_WebConfig_GetFullID(this.KeyID);
            //
            fConfigKey.Value   = daWebConfig.fConfigKey.ToString();
            fConfigValue.Value = daWebConfig.fConfigValue.ToString();
            fDescription.Value = daWebConfig.fDescription.ToString();

            //

            // Khi cần enabled cột nào
            if (this.KeyID > 0)
            {
                fConfigKey.Disabled = true;
            }
        }
        catch (Exception e)
        {
            ShowErrorMes("Lỗi hệ thống: " + e.ToString());
            return(false);
        }

        return(true);
    }
Ejemplo n.º 2
0
 override protected int DeleteByID(int pID)
 {
     try
     {
         DAWebConfig DAWebConfig = new DAWebConfig();
         DAWebConfig.USP_WebConfig_Delete(pID);
         return(1);
     }
     catch { return(0); }
 }
Ejemplo n.º 3
0
    override protected int ExecUpdate()
    {
        // Update with ID = this.ID
        try
        {
            DAWebConfig DAWebConfig = CreateObjectFromPage();
            DAWebConfig.fConfigID = this.KeyID;

            DAWebConfig.USP_WebConfig_Update();
            return(1);
        }
        catch { return(0); }
    }
Ejemplo n.º 4
0
    private DAWebConfig CreateObjectFromPage()
    {
        // check
        DAWebConfig daWebConfig = new DAWebConfig();

        //
        daWebConfig.fConfigKey   = fConfigKey.Value.Trim();
        daWebConfig.fConfigValue = fConfigValue.Value.Trim();
        daWebConfig.fDescription = fDescription.Value.Trim();

        //

        return(daWebConfig);
    }
Ejemplo n.º 5
0
    override protected int ExecInsert()
    {
        try
        {
            DAWebConfig DAWebConfig = CreateObjectFromPage();

            if (this.mode == ActParam.New)
            {
                DAWebConfig.fConfigID = DAWebConfig.USP_GetKey();
                this.KeyID            = DAWebConfig.fConfigID; // --> Update new SessionID for continue edit.
            }
            else
            {
                DAWebConfig.fConfigID = 0;
            }

            DAWebConfig.USP_WebConfig_Insert();
            return(1);
        }
        catch { return(0); }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Update
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void UpdateListConfigValue_CLick(object sender, EventArgs e)
    {
        //check valid input
        bool dataIsValid = true;

        //bool isIntValue;
        //foreach (GridDataItem item in RadGrid1.Items)
        //{
        //    isIntValue = bool.Parse(item["IsIntValue"].Text);
        //    //if it's integer value then checking
        //    if (isIntValue)
        //    {
        //        RadTextBox fConfigValue = (RadTextBox)item.FindControl("fConfigValue");
        //        int number;
        //        // check true or fasle integer value
        //        dataIsValid = int.TryParse(fConfigValue.Text, out number);
        //        if (!dataIsValid)
        //        {
        //            ShowErrorMes("Dữ liệu nhập vào không đúng format. Vui lòng nhập số.");
        //            break;
        //        }
        //    }
        //    //try
        //    //{
        //    //    isIntValue = bool.Parse(item["IsIntValue"].Text);
        //    //    //if it's integer value then checking
        //    //    if (isIntValue)
        //    //    {
        //    //        RadTextBox fConfigValue = (RadTextBox)item.FindControl("fConfigValue");
        //    //        int number;
        //    //        // check true or fasle integer value
        //    //        dataIsValid = int.TryParse(fConfigValue.Text, out number);
        //    //        if (!dataIsValid)
        //    //        {
        //    //            ShowErrorMes("Dữ liệu nhập vào không đúng format. Vui lòng nhập số.");
        //    //            break;
        //    //        }
        //    //    }

        //    //}
        //    //catch
        //    //{
        //    //    ShowErrorMes("Có lỗi xảy ra, vui lòng liên hệ Quản trị.");
        //    //    dataIsValid = false;
        //    //    break;
        //    //}
        //}
        //--------------------------------------------------------------------------------//
        if (dataIsValid)
        {
            int configID = 0;
            //Uupdate database
            foreach (GridDataItem item in RadGrid1.Items)
            {
                try
                {
                    // get data update
                    configID = int.Parse(item.GetDataKeyValue("ConfigID").ToString());
                    RadTextBox fConfigValue = (RadTextBox)item.FindControl("fConfigValue");

                    // update to database
                    DAWebConfig daWebConfig = new DAWebConfig();
                    daWebConfig.USP_WebConfig_UpdateListConfigValue(configID, fConfigValue.Text);
                }
                catch
                {
                    ShowErrorMes("Có lỗi! Cập nhật dữ liệu không thành công.");
                    dataIsValid = false;
                    break;
                }
            }
        }
        // check successful update
        if (dataIsValid)
        {
            ShowSuccessMes("Dữ liệu đã được cập nhật thành công. Vui lòng login lại.");
            LoadData();
        }
    }