Esempio n. 1
0
    private DASupportOnline CreateObjectFromPage()
    {
        // check
        DASupportOnline daSupportOnline = new DASupportOnline();

        //
        daSupportOnline.fSupportName = fSupportName.Value.Trim();
        HttpPostedFile file = inputFile.PostedFile;

        if (file != null && file.ContentLength > 0)
        {
            //Delete old file
            Utils.DeleteFile(fImgLink.ImageUrl, Server);
            daSupportOnline.fImgLink = Utils.UploadImage(file, Server, "~/Media/SupportOnline");
        }
        else
        {
            daSupportOnline.fImgLink = fImgLink.ImageUrl.Replace("~", "");
        }
        fImgLink.ImageUrl = "~" + daSupportOnline.fImgLink;


        daSupportOnline.fPhone      = fPhone.Value.Trim();
        daSupportOnline.fEmail      = fEmail.Value.Trim();
        daSupportOnline.fSkype      = fSkype.Value.Trim();
        daSupportOnline.fYahoo      = fYahoo.Value.Trim();
        daSupportOnline.fGooglePlus = fGooglePlus.Value.Trim();
        daSupportOnline.fFaceBook   = fFaceBook.Value.Trim();
        daSupportOnline.fActive     = fActive.Checked;
        daSupportOnline.fPos        = Convert.ToInt32(fPos.Value.Trim());

        //

        return(daSupportOnline);
    }
Esempio n. 2
0
 override protected int DeleteByID(int pID)
 {
     try
     {
         DASupportOnline DASupportOnline = new DASupportOnline();
         DASupportOnline.USP_SupportOnline_Delete(pID);
         return(1);
     }
     catch { return(0); }
 }
Esempio n. 3
0
    override protected int ExecUpdate()
    {
        // Update with ID = this.ID
        try
        {
            DASupportOnline DASupportOnline = CreateObjectFromPage();
            DASupportOnline.fID = this.KeyID;

            DASupportOnline.USP_SupportOnline_Update();
            return(1);
        }
        catch { return(0); }
    }
Esempio n. 4
0
    override protected int ExecInsert()
    {
        try
        {
            DASupportOnline DASupportOnline = CreateObjectFromPage();

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

            DASupportOnline.USP_SupportOnline_Insert();
            return(1);
        }
        catch { return(0); }
    }
Esempio n. 5
0
    override protected Boolean LoadData()
    {
        try
        {
            // Load Data For Page.
            DASupportOnline daSupportOnline = new DASupportOnline();
            daSupportOnline.USP_SupportOnline_GetFullID(this.KeyID);
            //
            fSupportName.Value = daSupportOnline.fSupportName.ToString();
            fImgLink.ImageUrl  = "~" + daSupportOnline.fImgLink.ToString();
            fPhone.Value       = daSupportOnline.fPhone.ToString();
            fEmail.Value       = daSupportOnline.fEmail.ToString();
            fSkype.Value       = daSupportOnline.fSkype.ToString();
            fYahoo.Value       = daSupportOnline.fYahoo.ToString();
            fGooglePlus.Value  = daSupportOnline.fGooglePlus.ToString();
            fFaceBook.Value    = daSupportOnline.fFaceBook.ToString();
            fActive.Checked    = daSupportOnline.fActive;
            fPos.Value         = daSupportOnline.fPos.ToString();

            //

            // Khi cần enabled cột nào
            //if (this.KeyID > 0)
            //{
            //    if (mode != Act.Clone)
            //        fUserName.Enabled = false;
            //    else
            //        fUserName.Text = "";
            //}
        }
        catch (Exception e)
        {
            ShowErrorMes("Lỗi hệ thống: " + e.ToString());
            return(false);
        }

        return(true);
    }