Esempio n. 1
0
 protected void btn_updateprofile_Click(object sender, EventArgs e)
 {
     DataTable table = (DataTable)Session["ThanhVien"];
     ND_THONG_TIN_ND nd = new ND_THONG_TIN_ND(table, 0);
     try
     {
         DateTime bithday = Convert.ToDateTime(String.Format("{0}/{1}/{2}", dropd_month.Text, dropd_day.Text, dropd_year.Text));
         bool ok = nd.Save_Object(txt_full_name.Text, nd.MEM_GROUP_ID, txt_address.Text, functions.GetStringDate(bithday),
             rd_sex.SelectedItem.Value, txt_phonenumber.Text, txt_faxnumber.Text, txt_email.Text, txt_website.Text,
            txt_yahoo.Text, txt_skype.Text, nd.TAX_CODE, nd.NOTE, nd.AVATAR_PATH, nd.VISIBLE_BIT,functions.CheckDate(nd.CREATED_DATE), nd.EDITED_BY,
            functions.GetStringDatetime(), nd.ID,nd.HEART);
         if (ok)
             lbl_error.Text = "Cập nhật thông tin cá nhân thành công";
         else lbl_error.Text = "Cập nhật thông tin cá nhân không thành công, vui lòng kiểm tra lại thông tin!";
     }
     catch (Exception ex)
     {
         lbl_error.Text = "Cập nhật thông tin cá không thành công" ;
     }
 }
Esempio n. 2
0
        private void display_info()
        {
            try
            {
                DataTable table = (DataTable)Session["ThanhVien"];
                if (table != null)
                {
                    ND_THONG_TIN_ND nd = new ND_THONG_TIN_ND(table, 0);
                    String avatar_name = nd.AVATAR_PATH == "" ? "default_img.gif" : nd.AVATAR_PATH;
                    txt_username.Text = (String)table.Rows[0][ND_THONG_TIN_DN.cl_USERNAME];
                    //if (table.Rows[0][ND_THONG_TIN_DN.cl_LASTED_ACCESS].ToString() != null)
                    //{
                    //    DateTime lasted_access = (DateTime)table.Rows[0][ND_THONG_TIN_DN.cl_LASTED_ACCESS];
                    //    lbl_lasted_access.Text = lasted_access.ToString("dd/MM/yyyy hh:mm:ss tt");
                    //}
                    //else
                    //{
                    //    lbl_lasted_access.Text = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt");

                    //}
                    lbl_lasted_access.Text = functions.getLastedAccess(table.Rows[0]["id"].ToString());
                    img_user.ImageUrl = "Images/avatars/" + avatar_name;

                    //Fill data on form

                    txt_address.Text = nd.ADDRESS;
                    txt_full_name.Text = nd.NAME;
                    txt_faxnumber.Text = nd.FAX;
                    txt_phonenumber.Text = nd.PHONE;
                    txt_email.Text = nd.EMAIL;
                    txt_website.Text = nd.WEBSITE;
                    txt_skype.Text = nd.SKYPE;
                    txt_yahoo.Text = nd.YAHOO;
                    DateTime birthday = DateTime.Parse(nd.BIRTH_DAY);

                    functions.selectedDropdown(dropd_day, birthday.Day.ToString());
                    functions.selectedDropdown(dropd_month, birthday.Month.ToString());
                    functions.selectedDropdown(dropd_year, birthday.Year.ToString());

                    rd_sex.Items[int.Parse(nd.SEX)].Selected = true;

                    lbl_group_name.Text = (String)table.Rows[0][ND_TEN_NHOM_ND.cl_GROUPNAME];
                    txt_note.Text = nd.NOTE;
                    //sum_point.Text = functions.returnPoint(table.Rows[0]["id"].ToString());
                }
            }
            catch (Exception ex) {
                lbl_group_name.Text = ex.ToString();
                //Response.Redirect("error_page.aspx");
            }
        }
Esempio n. 3
0
        //───────────────────────────────────────────────────────────────────────────────────────
        public static ND_THONG_TIN_ND Insert_Object(
            string  sNAME
            ,string  sMEM_GROUP_ID
            ,string  sADDRESS
            ,string  sBIRTH_DAY
            ,string  sSEX
            ,string  sPHONE
            ,string  sFAX
            ,string  sEMAIL
            ,string  sWEBSITE
            ,string  sYAHOO
            ,string  sSKYPE
            ,string  sTAX_CODE
            ,string  sNOTE
            ,string  sAVATAR_PATH
            ,string  sVISIBLE_BIT
            ,string  sCREATED_DATE
            ,string  sCREATED_BY
            ,string  sEDITED_DATE
            ,string  sEDITED_BY
            ,string  sHEART
            )
        {
            string tem_sNAME=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sNAME,"nvarchar");
              string tem_sMEM_GROUP_ID=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sMEM_GROUP_ID,"bigint");
              string tem_sADDRESS=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sADDRESS,"nvarchar");
              string tem_sBIRTH_DAY=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sBIRTH_DAY,"datetime");
              string tem_sSEX=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sSEX,"int");
              string tem_sPHONE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sPHONE,"nvarchar");
              string tem_sFAX=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sFAX,"nvarchar");
              string tem_sEMAIL=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sEMAIL,"nvarchar");
              string tem_sWEBSITE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sWEBSITE,"nvarchar");
              string tem_sYAHOO=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sYAHOO,"nvarchar");
              string tem_sSKYPE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sSKYPE,"nvarchar");
              string tem_sTAX_CODE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sTAX_CODE,"nvarchar");
              string tem_sNOTE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sNOTE,"nvarchar");
              string tem_sAVATAR_PATH=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sAVATAR_PATH,"nvarchar");
              string tem_sVISIBLE_BIT=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sVISIBLE_BIT,"char");
              string tem_sCREATED_DATE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sCREATED_DATE,"datetime");
              string tem_sCREATED_BY=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sCREATED_BY,"bigint");
              string tem_sEDITED_DATE=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sEDITED_DATE,"datetime");
              string tem_sEDITED_BY=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sEDITED_BY,"bigint");
              string tem_sHEART=DK2C.DataAccess.Web.SQLToolWeb.GetSaveValue(sHEART,"bigint");

             string sqlSave=" INSERT INTO ND_THONG_TIN_ND("+
                   "NAME,"
            +                   "MEM_GROUP_ID,"
            +                   "ADDRESS,"
            +                   "BIRTH_DAY,"
            +                   "SEX,"
            +                   "PHONE,"
            +                   "FAX,"
            +                   "EMAIL,"
            +                   "WEBSITE,"
            +                   "YAHOO,"
            +                   "SKYPE,"
            +                   "TAX_CODE,"
            +                   "NOTE,"
            +                   "AVATAR_PATH,"
            +                   "VISIBLE_BIT,"
            +                   "CREATED_DATE,"
            +                   "CREATED_BY,"
            +                   "EDITED_DATE,"
            +                   "EDITED_BY,"
            +                   "HEART) VALUES("
             +tem_sNAME+","
             +tem_sMEM_GROUP_ID+","
             +tem_sADDRESS+","
             +tem_sBIRTH_DAY+","
             +tem_sSEX+","
             +tem_sPHONE+","
             +tem_sFAX+","
             +tem_sEMAIL+","
             +tem_sWEBSITE+","
             +tem_sYAHOO+","
             +tem_sSKYPE+","
             +tem_sTAX_CODE+","
             +tem_sNOTE+","
             +tem_sAVATAR_PATH+","
             +tem_sVISIBLE_BIT+","
             +tem_sCREATED_DATE+","
             +tem_sCREATED_BY+","
             +tem_sEDITED_DATE+","
             +tem_sEDITED_BY+","
             +tem_sHEART +")";
             bool OK = Exec(sqlSave)>=1?true:false;
               if (OK)
               {
              ND_THONG_TIN_ND newND_THONG_TIN_ND= new ND_THONG_TIN_ND();
                 newND_THONG_TIN_ND.ID=GetTable( " SELECT TOP 1 ID FROM ND_THONG_TIN_ND ORDER BY ID DESC ").Rows[0][0].ToString();
              newND_THONG_TIN_ND.NAME=sNAME;
              newND_THONG_TIN_ND.MEM_GROUP_ID=sMEM_GROUP_ID;
              newND_THONG_TIN_ND.ADDRESS=sADDRESS;
              newND_THONG_TIN_ND.BIRTH_DAY=sBIRTH_DAY;
              newND_THONG_TIN_ND.SEX=sSEX;
              newND_THONG_TIN_ND.PHONE=sPHONE;
              newND_THONG_TIN_ND.FAX=sFAX;
              newND_THONG_TIN_ND.EMAIL=sEMAIL;
              newND_THONG_TIN_ND.WEBSITE=sWEBSITE;
              newND_THONG_TIN_ND.YAHOO=sYAHOO;
              newND_THONG_TIN_ND.SKYPE=sSKYPE;
              newND_THONG_TIN_ND.TAX_CODE=sTAX_CODE;
              newND_THONG_TIN_ND.NOTE=sNOTE;
              newND_THONG_TIN_ND.AVATAR_PATH=sAVATAR_PATH;
              newND_THONG_TIN_ND.VISIBLE_BIT=sVISIBLE_BIT;
              newND_THONG_TIN_ND.CREATED_DATE=sCREATED_DATE;
              newND_THONG_TIN_ND.CREATED_BY=sCREATED_BY;
              newND_THONG_TIN_ND.EDITED_DATE=sEDITED_DATE;
              newND_THONG_TIN_ND.EDITED_BY=sEDITED_BY;
              newND_THONG_TIN_ND.HEART=sHEART;
            return newND_THONG_TIN_ND;
               }
               else return null ;
        }