예제 #1
0
        public void ModifyPasswordByEgui()
        {
            string OldPassword = Request["OldPassword"];
            string NewPassword = Request["NewPassword"];

            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    PartnerUser partnetUser = p.Client.GetPartnerUser(SenderUser, this.CurrentUser.UserID);
                    if (CEncrypt.DecryptString(partnetUser.Password) != OldPassword)
                    {
                        WriteMessage(-1, "原密码错误,请重新输入");
                        return;
                    }
                    partnetUser.Password = CEncrypt.EncryptString(NewPassword);
                    SavePartnerUserArgs arge = new SavePartnerUserArgs();
                    arge.PartnerUser = partnetUser;
                    p.Client.SavePartnerUser(SenderUser, arge);
                    WriteSuccess();
                }
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }
예제 #2
0
        //当前用户修改密码
        public void ModifiyPsw()
        {
            string OldPassword = Request["OldPassword"];
            string NewPassword = Request["NewPassword"];

            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    User user = p.Client.GetUser(SenderUser, this.CurrentUser.UserID);

                    if (CEncrypt.DecryptString(user.Password) != OldPassword)
                    {
                        throw new Exception("旧密码错误");
                    }
                    user.Password = CEncrypt.EncryptString(NewPassword);
                    SaveUserArgs sarg = new SaveUserArgs();
                    sarg.User = user;
                    p.Client.SaveUser(SenderUser, sarg);
                    WriteSuccess();
                }
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public void ToSplit()
        {
            //string designId = Request["designId"] ?? "";



            string cabinetType = Request["CabinetType"] ?? "Wardrobe"; //衣柜、橱柜
            string DesignerID  = Request["DesignerID"] ?? "";
            string DesignerNo  = Request["DesignerNo"] ?? "";
            string result      = "";
            string uid         = "meiwu";
            //福满多测试
            string pwd = "pwd123456";

            //string SolutionFileUrl = "";
            //string TaskID = "";

            string ReferenceID = DesignerID;
            string CustomerID  = "";

            //string lid = "13760865705";
            //string designId = "3FO4IH68IPBB";

            string   lid      = "";
            string   designId = "";
            string   Password = "";
            Database db1      = new Database("BE_RoomDesignerKJLRelation_Proc", "CHENINFO", 0, 0, DesignerNo, "", "");

            using (SqlDataReader dr = db1.ExecuteReader())
            {
                if (dr.Read())
                {
                    uid      = dr["CompanyCode"].ToString();
                    lid      = dr["UserCode"].ToString();
                    designId = dr["KJLDesignID"].ToString();
                    Password = dr["Password"].ToString();
                    Password = CEncrypt.DecryptString(Password);
                    Password = "******";
                }
                else
                {
                    throw new Exception(DesignerNo);
                }
            }



            LoginResult restCache;

            //if (CacheHelpers.GetCache("LoginResult") != null)
            //{
            //    restCache = (LoginResult)CacheHelpers.GetCache("LoginResult");
            //    if (!restCache.success)
            //    {
            //        restCache = login3DWeb(uid, lid, pwd);
            //        CacheHelpers.SetCache("LoginResult", restCache, new TimeSpan(23, 0, 0));
            //    }
            //}
            //else
            //{
            //    restCache = login3DWeb(uid, lid, pwd);
            //    CacheHelpers.SetCache("LoginResult", restCache, new TimeSpan(23, 0, 0));
            //}


            restCache = login3DWeb(uid, lid, pwd);

            SplitData sdata = new SplitData();

            try
            {
                Database db = new Database("BE_RoomDesignerKJLRelation_Proc", "CHENSPLID", 0, 0, designId, "", "");
                using (SqlDataReader rd = db.ExecuteReader())
                {
                    if (rd.Read())
                    {
                        sdata.appName        = cabinetType;
                        sdata.obsDesignId    = designId;
                        sdata.cusOrderId     = rd[0].ToString();
                        sdata.cusName        = rd[1].ToString();;
                        sdata.cusPhone       = rd[2].ToString();;
                        sdata.cusAddress     = rd[3].ToString();;
                        sdata.beginOrderData = rd[4].ToString();
                        DesignerID           = rd[5].ToString();
                        CustomerID           = rd[6].ToString();
                        sdata.endOrderData   = "";

                        CookieContainer cc = restCache.msg as CookieContainer;

                        //process=1橱柜;process=2衣柜
                        LoginResult cResult = check3DWeb(cc, 2);
                        if (cResult.success == false)
                        {
                            //throw new Exception(cResult.msg.ToString());
                            WriteMessage(0, cResult.msg.ToString());
                        }
                        //result = split3DWeb(cc, JsonConvert.SerializeObject(sdata));
                        result = submitDesign(uid, lid, Password, sdata);


                        if (result.IndexOf("成功") != -1)
                        {
                            string uploadPath = "/temp/" + DateTime.Now.ToString("yyyyMMdd") + "/SolutionFile/";

                            string ServerPath = Server.MapPath(uploadPath);


                            if (!Directory.Exists(ServerPath))
                            {
                                Directory.CreateDirectory(ServerPath);
                            }



                            string filepath = ServerPath + DesignerNo + ".zip";
                            uploadPath = uploadPath + DesignerNo + ".zip";
                            //FileStream fs = new FileStream(filepath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);

                            string rst = separateBill(uid, lid, Password, filepath, designId, "衣柜");
                            if (rst.IndexOf("false") != -1)
                            {
                                WriteMessage(0, rst);
                            }
                            else
                            {
                                WriteMessage(1, uploadPath);
                            }


                            //LoginResult loginResult = JsonConvert.DeserializeObject<LoginResult>(result);
                            //Uri url = new Uri(loginResult.msg.ToString());
                            //byte[] byteArray = Encoding.UTF8.GetBytes(url.Query.Substring(1));
                            ////Cookie cookieRequest = new Cookie("Cid", "FFFFFFFFFFFFFFFF");

                            ////cookieRequest.Domain = "120.77.62.58";
                            //HttpWebRequest request = WebRequest.Create(loginResult.msg.ToString()) as HttpWebRequest;

                            //request.Method = "POST";
                            //request.KeepAlive = false;
                            //request.ContentType = "application/x-www-form-urlencoded";
                            //request.ContentLength = byteArray.Length;
                            ////request.CookieContainer = new CookieContainer();
                            //request.CookieContainer = cc;
                            //Stream requestStream = request.GetRequestStream();
                            //requestStream.Write(byteArray, 0, byteArray.Length);
                            //requestStream.Flush();
                            //requestStream.Close();

                            //HttpWebResponse response = request.GetResponse() as HttpWebResponse;

                            ////CookieContainer cookieResponse = new CookieContainer();
                            ////cookieResponse.Add(response.Cookies);
                            //Stream stream = response.GetResponseStream();
                            //byte[] bArr = new byte[1024];
                            //int size = stream.Read(bArr, 0, (int)bArr.Length);



                            //string uploadPath = "/temp/" + DateTime.Now.ToString("yyyyMMdd") + "/SolutionFile/";

                            //string ServerPath = Server.MapPath(uploadPath);


                            //if (!Directory.Exists(ServerPath))
                            //{
                            //    Directory.CreateDirectory(ServerPath);
                            //}



                            //string filepath = ServerPath + DesignerNo + ".zip";
                            //uploadPath = uploadPath + DesignerNo + ".zip";
                            //FileStream fs = new FileStream(filepath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
                            //while (size > 0)
                            //{
                            //    //stream.Write(bArr, 0, size);
                            //    fs.Write(bArr, 0, size);
                            //    size = stream.Read(bArr, 0, (int)bArr.Length);
                            //}
                            //fs.Close();
                            //stream.Close();
                        }
                        else
                        {
                            WriteMessage(0, result);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            //Response.Write(result);
        }
예제 #4
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            bool result = false;

            try
            {
                if (this.txtUserID.Text == "")
                {
                    MessageBox.Show("请输入用户ID。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.txtUserID.Focus();
                    this.DialogResult = DialogResult.None;
                    return;
                }

                if (this.txtPassword.Text == "")
                {
                    this.DialogResult = MessageBox.Show("请输入用户密码。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.txtPassword.Focus();
                    this.DialogResult = DialogResult.None;
                    return;
                }

                using (ProxyBE p = new ProxyBE())
                {
                    User theUser = p.Client.GetUserByUserCode(null, txtUserID.Text);
                    if (theUser == null)
                    {
                        MessageBox.Show("用户不存在。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.txtUserID.Focus();
                        this.DialogResult = DialogResult.None;
                        return;
                    }
                    else
                    {
                        if (CEncrypt.DecryptString(theUser.Password) != this.txtPassword.Text)
                        {
                            MessageBox.Show("密码不正确。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.txtUserID.Focus();
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                    OnlineUser onlineuser = new OnlineUser();
                    onlineuser.UserID    = theUser.UserID;
                    onlineuser.UserCode  = theUser.UserCode;
                    onlineuser.UserName  = theUser.UserName;
                    onlineuser.CompanyID = theUser.CompanyID;
                    CGlobal.CurrentUser  = onlineuser;
                    result = true;
                }
            }
            catch (Exception ex)
            {
                PLogger.LogError(ex);
                MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.None;
            }
            if (result)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }