public Result FileIsPublish(string fileCoverID, string account, string setPrice, int publishStatus)
        {
            Result result = new Result();

            try
            {
                Guid            g               = new Guid(fileCoverID);
                PCBEntities     pCBEntities     = new PCBEntities();
                PCB_FileCoverTB pCB_FileCoverTB = pCBEntities.PCB_FileCoverTB.FirstOrDefault(p => p.FileCoverID == g && p.CreateAccount == account);
                if (pCB_FileCoverTB == null || pCB_FileCoverTB == default(PCB_FileCoverTB))
                {
                    result.IsOK        = false;
                    result.Description = "找不到该文件信息";
                    return(result);
                }
                pCB_FileCoverTB.Price          = setPrice;
                pCB_FileCoverTB.IsPublish      = Convert.ToBoolean(publishStatus);
                pCB_FileCoverTB.UpdateDateTime = DateTime.Now;
                pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, pCB_FileCoverTB);
                result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                if (!result.IsOK)
                {
                    result.Description = "发布失败";
                    return(result);
                }
                result.Description = "发布成功";
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string context = "hand?" + Common.Common.Decrypt(HttpContext.Current.Request.Url.Query.TrimStart('?'));

            HttpContext.Current.RewritePath(context);
            string   mailAddress = HttpContext.Current.Request.QueryString.Get("mailAddress");
            string   dateTime    = HttpContext.Current.Request.QueryString.Get("dateTime");
            TimeSpan UseTime     = DateTime.Now - Convert.ToDateTime(dateTime);

            if (UseTime.Seconds >= 60)
            {
                Response.Redirect(ParameterAPI.GetConfig("RegisterFURL").ConfigValue + "?mailaddr=" + mailAddress, false);
            }
            else
            {
                PCBEntities      pCBEntities  = new PCBEntities();
                PCB_EngineerInfo engineerInfo = pCBEntities.PCB_EngineerInfo.FirstOrDefault(p => p.MailAddress == mailAddress);
                if (engineerInfo != null && engineerInfo != default(PCB_EngineerInfo))
                {
                    engineerInfo.UpdateDateTime = DateTime.Now;
                    engineerInfo.StateCode      = true;
                    pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, engineerInfo);
                    bool isok = Convert.ToBoolean(pCBEntities.SaveChanges());
                    if (isok)
                    {
                        Response.Redirect(ParameterAPI.GetConfig("RegisterSURL").ConfigValue + "?mailaddr=" + mailAddress + "&isconfirm=true", false);
                    }
                    else
                    {
                        Response.Redirect(ParameterAPI.GetConfig("RegisterFURL").ConfigValue + "?mailaddr=" + mailAddress, false);
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新订单表记录
        /// </summary>
        /// <param name="account"></param>
        /// <param name="tradeNO"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        public static Result UpdateOrderTB(string account, string tradeNO)
        {
            Result result = new Result();

            try
            {
                result.IsOK        = true;
                result.StateCodeID = 0;
                PCBEntities pCBEntities = new PCBEntities();
                PCB_OrderTB PCBOrderTB  = pCBEntities.PCB_OrderTB.FirstOrDefault(p => p.CreateAccount == account && p.OrderNumber == tradeNO);
                if (PCBOrderTB != null)
                {
                    PCBOrderTB.IsPay          = true;
                    PCBOrderTB.UpdateDateTime = DateTime.Now;

                    pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, PCBOrderTB);

                    result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(Common)).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.Message;
            }
            return(result);
        }
        public Result EditFileCover(string fileCoverID, string fileExtension, string fileCoverName, string account, Byte[] newFileData)
        {
            string saveToUrl = "";
            Result result    = new Result();

            try
            {
                Guid            g               = new Guid(fileCoverID);
                PCBEntities     pCBEntities     = new PCBEntities();
                PCB_FileCoverTB pCB_FileCoverTB = pCBEntities.PCB_FileCoverTB.FirstOrDefault(p => p.FileCoverID == g && p.CreateAccount == account);
                if (pCB_FileCoverTB == null || pCB_FileCoverTB == default(PCB_FileCoverTB))
                {
                    result.IsOK        = false;
                    result.Description = "找不到该文件信息";
                    return(result);
                }
                String dir    = @ParameterAPI.GetConfig("FileURL").ConfigValue + @"\\" + account + @"\\" + fileCoverID;
                string oldUrl = dir + @"\\" + pCB_FileCoverTB.FileCoverName + "." + pCB_FileCoverTB.FileExtension;
                if (string.IsNullOrEmpty(fileCoverName))
                {
                    pCB_FileCoverTB.FileCoverName = fileCoverName;
                }
                if (newFileData.Length > 0)
                {
                    pCB_FileCoverTB.FileSize     = newFileData.Length.ToString();
                    pCB_FileCoverTB.FileMD5      = Common.Common.GetMD5Hash(newFileData);
                    pCB_FileCoverTB.FileCoverURL = ParameterAPI.GetConfig("DowLoadFileURL").ConfigValue + "//" + account + "//" + g + "//" + fileCoverName + "." + fileExtension;

                    saveToUrl = dir + @"\\" + fileCoverName + "." + fileExtension;
                    result    = Common.Common.FileWrite(saveToUrl, newFileData);
                    if (!result.IsOK)
                    {
                        return(result);
                    }
                    pCB_FileCoverTB.UpdateDateTime = DateTime.Now;
                    pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, pCB_FileCoverTB);
                    result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                    if (!result.IsOK)
                    {
                        File.Delete(saveToUrl);
                        result.Description = "编辑失败";
                        return(result);
                    }
                    File.Delete(oldUrl);
                    result.Description = "编辑成功";
                }
            }
            catch (Exception ex)
            {
                File.Delete(saveToUrl);
                LogHelper.WriteLog(GetType()).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }
Beispiel #5
0
        public Result UpdateSysParams(string key, string value, string remark)
        {
            Result result = new Result();

            result.StateCodeID = 0;
            result.IsOK        = false;
            try
            {
                PCBEntities pCBEntities = new PCBEntities();
                //PCB_ConfigTB configSys = ParameterAPI.GetConfig(key);
                PCB_ConfigTB configSys = pCBEntities.PCB_ConfigTB.FirstOrDefault(p => p.ConfigCode == key);
                if (configSys == null)
                {
                    ////增加
                    //PCB_ConfigTB confignew = new PCB_ConfigTB();
                    //confignew.ConfigID = new Guid();
                    //confignew.ConfigCode = key;
                    //confignew.ConfigValue = value;
                    //confignew.Remark = remark;
                    //pCBEntities.AddToPCB_ConfigTB(confignew);

                    //result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                    //if (result.IsOK)
                    //    result.Description = "增加" + key + "成功";
                    result.IsOK        = false;
                    result.StateCodeID = 1;
                    result.Description = "没有找到需要更新对应项";
                    return(result);
                }
                else
                {
                    //更新
                    configSys.ConfigValue = value;
                    configSys.Remark      = remark;
                    pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, configSys);
                    result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                    //result = Common.Common.UpdateConfigTB(key, value, remark);
                    if (result.IsOK)
                    {
                        result.Description = "更新" + key + "成功";
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.Message;
            }
            return(result);
        }
Beispiel #6
0
        public Result EditeAccountInfo(string account, string password, string accountName, string phoneNo, string weChatAccount)
        {
            Result result = new Result();

            try
            {
                PCBEntities      pCBEntities      = new PCBEntities();
                PCB_EngineerInfo pCB_EngineerInfo = pCBEntities.PCB_EngineerInfo.FirstOrDefault(p => p.Account == account && p.Password == password && p.StateCode == true);
                if (pCB_EngineerInfo == null)
                {
                    result.IsOK        = false;
                    result.Description = "没有该账号信息";
                    return(result);
                }
                if (!string.IsNullOrEmpty(accountName))
                {
                    pCB_EngineerInfo.AccountName = accountName;
                }
                if (!string.IsNullOrEmpty(phoneNo))
                {
                    pCB_EngineerInfo.PhoneNo = phoneNo;
                }
                if (!string.IsNullOrEmpty(weChatAccount))
                {
                    pCB_EngineerInfo.WeChatAccount = weChatAccount;
                }


                pCB_EngineerInfo.UpdateDateTime = DateTime.Now;

                pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, pCB_EngineerInfo);
                result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                if (!result.IsOK)
                {
                    result.Description = "保存异常";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }
Beispiel #7
0
        public Result ChangePassword(string account, string oldPassword, string newPassword)
        {
            Result result = new Result();

            try
            {
                PCBEntities      pCBEntities  = new PCBEntities();
                PCB_EngineerInfo engineerInfo = pCBEntities.PCB_EngineerInfo.FirstOrDefault(p => (p.Account == account || p.MailAddress == account) && p.StateCode == true);
                if (engineerInfo == null || engineerInfo == default(PCB_EngineerInfo))
                {
                    result.IsOK        = false;
                    result.Description = "输入的用户" + account + "不存在";
                    return(result);
                }
                if (oldPassword != engineerInfo.Password)
                {
                    result.IsOK        = false;
                    result.Description = "输入的旧密码有误";
                    return(result);
                }
                if (string.IsNullOrEmpty(newPassword))
                {
                    result.IsOK        = false;
                    result.Description = "输入的新密码不能为空";
                    return(result);
                }

                engineerInfo.Password       = newPassword;
                engineerInfo.UpdateDateTime = DateTime.Now;
                pCBEntities.Refresh(System.Data.Objects.RefreshMode.ClientWins, engineerInfo);
                result.IsOK = Convert.ToBoolean(pCBEntities.SaveChanges());
                if (!result.IsOK)
                {
                    result.Description = "修改密码失败";
                    return(result);
                }
                result.Description = "账号" + account + "的密码修改成功";
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(GetType()).Info(ex.StackTrace);
                result.IsOK        = false;
                result.Description = ex.InnerException.Message;
            }
            return(result);
        }