コード例 #1
0
        protected void lbtnAdd_Click(object sender, EventArgs e)
        {
            List <string> sellist = ctrlGridEx1.GetSelects();

            if (sellist.Count > 0)
            {
                List <int> rowIndexList = ctrlGridEx1.GetSelectsRowIndexList();
                for (int i = 0; i < sellist.Count; i++)
                {
                    FileUpload f1       = (FileUpload)ctrlGridEx1.Rows[rowIndexList[i]].Cells[5].Controls[0];
                    string     savePath = "/Upload/CompanySignet/";
                    string     fileName = Common.Common.SaveFile(Server.MapPath(savePath), f1.PostedFile, "Signet_", "jpg,gif,bmp");

                    if (fileName != "")
                    {
                        string SystemInfoID           = sellist[i];
                        Model.T_SystemInfo_MDL sysMDL = (new BLL.T_SystemInfo_BLL()).GetModel(Common.ConvertEx.ToInt(SystemInfoID));

                        T_FileAttach_BLL fileAttBLL = new T_FileAttach_BLL();
                        T_FileAttach_MDL fileAttMDL = new T_FileAttach_MDL();

                        fileAttMDL.Flag        = sysMDL.CurrentType;
                        fileAttMDL.PriKeyValue = Common.ConvertEx.ToInt(_CompanyID);
                        fileAttMDL.AttachPath  = savePath + fileName;
                        fileAttMDL.AttachName  = sysMDL.CurrentTypeCNName;
                        fileAttMDL.AttachCode  = sysMDL.SystemInfoCode;
                        fileAttMDL.CreateDate  = DateTime.Now;
                        fileAttMDL.OrderIndex  = 1;
                        fileAttMDL.AttachID    = Common.ConvertEx.ToInt(ctrlGridEx1.Rows[rowIndexList[i]].Cells[1].Text);

                        if (fileAttMDL.AttachID == 0)
                        {
                            fileAttBLL.Add(fileAttMDL);
                        }
                        else
                        {
                            fileAttBLL.Update(fileAttMDL);
                        }
                    }
                }
                BindGrid();
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.T_SystemInfo_MDL model = new DigiPower.Onlinecol.Standard.Model.T_SystemInfo_MDL();
            if (ViewState["model"] != null)
            {
                model = (Model.T_SystemInfo_MDL)ViewState["model"];
            }

            BLL.T_SystemInfo_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_SystemInfo_BLL();

            object obj = Comm.GetValueToObject(model, this.tbl);

            if (obj != null)
            {
                Model.T_SystemInfo_MDL Newmodel = (Model.T_SystemInfo_MDL)obj;

                switch ((CommonEnum.PageState)ViewState["ps"])
                {
                case CommonEnum.PageState.ADD:
                    int systemInfoID = bll.Add(Newmodel);

                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_SystemInfo;key=", systemInfoID,
                                                                                                ";CurrentType=", Newmodel.CurrentType, ";SystemInfoCode=", Newmodel.SystemInfoCode, ";SystemInfoName=", Newmodel.SystemInfoName));
                    break;

                case CommonEnum.PageState.EDIT: {
                    bll.Update(Newmodel);

                    PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_SystemInfo;key=", Newmodel.SystemInfoID,
                                                                                                ";CurrentType=", Newmodel.CurrentType, ";SystemInfoCode=", Newmodel.SystemInfoCode, ";SystemInfoName=", Newmodel.SystemInfoName));
                }
                break;
                }
            }

            Common.MessageBox.CloseLayerOpenWeb(this.Page);
        }
コード例 #3
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string getUserInfo(HttpContext context)
        {
            try {
                if (context.Request.Form["username"] == null || context.Request.Form["password"] == null)
                {
                    return("账号或密码为空!");
                }

                T_UsersInfo_BLL userinfobll = new T_UsersInfo_BLL();

                string strPrivateKey = string.Empty;
                using (StreamReader reader = new StreamReader(context.Server.MapPath("/RsaKey/PrivateKey.xml"))) {
                    strPrivateKey = reader.ReadToEnd();
                }

                RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
                rsa.FromXmlString(strPrivateKey);

                byte[] result = rsa.Decrypt(UserLoginGather.HexStringToBytes(context.Request.Form["password"]), false);
                System.Text.ASCIIEncoding enc = new ASCIIEncoding();
                string rsaPwd = enc.GetString(result);

                string loginString = "UPPER(loginname)='" + Common.Common.SqlSafe(context.Request.Form["username"]).ToUpper()
                                     + "' and passwd='" + DESEncrypt.Encrypt(rsaPwd) + "' ";

                List <T_UsersInfo_MDL> userinfomdl = userinfobll.GetModelList(loginString);
                if (userinfomdl.Count > 0)
                {
                    if (userinfomdl[0].IsValid == true)
                    {
                        T_Company_BLL compBLL = new T_Company_BLL();
                        T_Company_MDL compMDL = compBLL.GetModel(userinfomdl[0].CompanyID);
                        if (compMDL != null)
                        {
                            context.Session["IsCompany"]     = compMDL.IsCompany.ToString().ToLower();
                            context.Session["CompanyName"]   = compMDL.CompanyName;
                            context.Session["OLD_AREA_CODE"] = compMDL.AREA_CODE;
                            context.Session["AREA_CODE"]     = "";
                            if (compMDL.IsCompany.ToString().ToLower() == "false")     //只有档案馆,需要区域信息,建设单位等都不要过虑
                            {
                                string myArea_Code    = compMDL.AREA_CODE;
                                string myArea_CodeNew = compMDL.AREA_CODE;
                                for (int i1 = myArea_Code.Length - 1; i1 > 0; i1--)
                                {
                                    if (myArea_Code[i1].ToString() == "0")
                                    {
                                        myArea_CodeNew = myArea_Code.Substring(0, i1);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                context.Session["AREA_CODE"] = myArea_CodeNew;
                            }
                            context.Session["CompanyType"] = compMDL.CompanyType;
                        }
                        else
                        {
                            return(SystemSet._RETURN_FAILURE_VALUE + ":单位信息不存在!");
                        }

                        BLL.T_SystemInfo_BLL   systemInfoBLL = new T_SystemInfo_BLL();
                        Model.T_SystemInfo_MDL systemInfoMDL = systemInfoBLL.GetModel(compMDL.CompanyType);
                        if (systemInfoMDL == null)
                        {
                            return(SystemSet._RETURN_FAILURE_VALUE + ":单位类型字典不存在!");
                        }

                        context.Session["CompanyTypeName"] = systemInfoMDL.SystemInfoName;
                        context.Session["CompanyTypeCode"] = systemInfoMDL.SystemInfoCode;
                        context.Session["SystemInfoID"]    = systemInfoMDL.SystemInfoID;
                        context.Session["MyParentID"]      = systemInfoMDL.ParentID;

                        context.Session["UserID"]       = userinfomdl[0].UserID;
                        context.Session["LoginName"]    = userinfomdl[0].LoginName;
                        context.Session["UserName"]     = userinfomdl[0].UserName;
                        context.Session["RoleID"]       = userinfomdl[0].RoleID;
                        context.Session["CompanyID"]    = userinfomdl[0].CompanyID;
                        context.Session["IsLeader"]     = userinfomdl[0].IsLeader;
                        context.Session["SuperAdmin"]   = userinfomdl[0].IsSuperAdmin;
                        context.Session["OwnerFileTmp"] = userinfomdl[0].OwnerFileTmp;         //外协单位用户

                        T_Role_MDL roleMDL = new T_Role_BLL().GetModel(userinfomdl[0].RoleID); //签章用
                        if (roleMDL != null)
                        {
                            context.Session["RoleName"] = roleMDL.RoleName;
                            context.Session["RoleCode"] = roleMDL.RoleCode;
                        }

                        TimeSpan ts      = new TimeSpan(8760, 0, 0);
                        DateTime expired = DateTime.Today.Add(ts);
                        HttpContext.Current.Response.Cookies["LoginName"].Value   = context.Server.UrlEncode(userinfomdl[0].LoginName);
                        HttpContext.Current.Response.Cookies["LoginName"].Expires = expired;

                        //修改最后登录时间
                        userinfomdl[0].LastLoginTime = DateTime.Now;
                        userinfobll.Update(userinfomdl[0]);

                        PublicModel.writeLog(SystemSet.EumLogType.LogIn.ToString(), ";用户登录系统");
                        return(SystemSet._RETURN_SUCCESS_VALUE);
                    }
                    else
                    {
                        return("如果您已经成功注册,请等待确认后再登录!");
                    }
                }
                else
                {
                    return("用户账号或密码错误!");
                }
            } catch (Exception ex) {
                Common.LogUtil.Debug(this, "用户登录BUG", ex);
                return("系统异常,请稍后再试");
            }
        }