Exemple #1
0
 /// <summary>
 /// ����
 /// </summary>
 /// <param name="prmCachet"></param>
 public long saveCachet(cachetList prmCachet)
 {
     long _id = 0;
     if (prmCachet.clID > 0)
     {
         flieds = new NBear.Common.PropertyItem[]{
             cachetList._.clImg,
             cachetList._.clName,
             cachetList._.clPwd,
             cachetList._.clTime,
             cachetList._.clUsid,
             cachetList._.clUsids,
             cachetList._.clUsnames
         };
         values = new object[]{
             prmCachet.clImg,
             prmCachet.clName,
             prmCachet.clPwd,
             prmCachet.clTime,
             prmCachet.clUsid,
             prmCachet.clUsids,
             prmCachet.clUsnames
         };
         db.Update<cachetList>(flieds, values, cachetList._.clID == prmCachet.clID);
         _id = prmCachet.clID;
     }
     else
     {
         _id = db.Save<cachetList>(prmCachet);
     }
     return _id;
 }
Exemple #2
0
        protected void lbtSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                cachetList cachet = new cachetList();
                bool isnew = true;
                if (iId > 0)
                {
                    cachet = csCachet.getCachet(iId);
                    isnew = false;
                }
                cachet.clName = TextBox1.Text.Trim();
                if (isnew)
                {
                    if (!string.IsNullOrEmpty(TextBox3.Text.Trim()))
                        cachet.clPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox3.Text.Trim(), "MD5");
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "Error", "��û����������!");
                        return;
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(TextBox3.Text.Trim()))
                        cachet.clPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox3.Text.Trim(), "MD5");
                }
                cachet.clUsids = TextBox5.Value;
                cachet.clUsid = Comp.csParse.ParseSL(Comp.csLogin.getLoginID(this.Page));
                if (isnew)
                {
                    if (FileUpload1.HasFile)
                        cachet.clImg = FileUpload1.FileBytes;
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "Error", "��û��ѡ��ͼƬ!");
                        return;
                    }
                }
                else
                {
                    if (FileUpload1.HasFile)
                        cachet.clImg = FileUpload1.FileBytes;
                }
                cachet.clTime = DateTime.Now;
                csCachet.saveCachet(cachet);

                Response.Redirect("CachetList.aspx");
            }
        }