protected void btnRegist_Click(object sender, EventArgs e) { string RName = txtRName.Text; string Pwd = txtPwd.Text; string Pwd2 = txtPwd2.Text; string email = txtemail.Text; Model.Regist regist = new Model.Regist(); regist.RegistName = RName; regist.Rpwd = Pwd; regist.Rpwd = Pwd2; regist.REmail = email; if (!new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,6})\\s*$").IsMatch(txtemail.Text)) { Response.Write("<script> alert('邮箱格式不正确!')</script>"); return; } if (DAL.RgistDAL.InsertRegist(regist) > 0) { Response.Write("<script>alert('注册成功!')</script>"); Response.Redirect("FoodInformation.aspx"); } else { Response.Write("<script>alert('注册失败!')</script>"); return; } }
/// <summary> /// 获取当前任务的数据库连接串 /// </summary> /// <param name="dt"></param> /// <returns></returns> public Model.ConnectInfo GetConnectInfo(Model.Synergismlogdt dt) { DAL.Regist rdal = new Regist(); Model.Regist rmdoel = rdal.GetModel(dt.Accid); if (rmdoel != null) { Model.ConnectInfo cimodel = new Model.ConnectInfo(); cimodel.AccId = rmdoel.Cacc_id; cimodel.Source = rmdoel.Datasource; cimodel.Password = rmdoel.Cpassword; cimodel.Srv = rmdoel.Caddress; //应用服务器 add by wangdd cimodel.sSrv = rmdoel.Cservername; cimodel.SubId = "DP"; //测试 cimodel.UserId = rmdoel.Cuser_id; cimodel.YearId = rmdoel.Ibeginyear.ToString(); cimodel.Serial = BLL.Common.GetSerial(); cimodel.BEnable = rmdoel.Benable == "1" || rmdoel.Benable == "是"; cimodel.Constring = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID=sa;Password={2};Current Language=Simplified Chinese", rmdoel.Caddress, rmdoel.Caccname, rmdoel.Cdbpwd); cimodel.Date = BLL.Common.GetVerifyData(dt); if (cimodel.Date == DateTime.Now.ToString("yyyy-MM-dd")) { cimodel.Date = BLL.Common.GetLoginDate(rmdoel); } return(cimodel); } return(null); }
/// <summary> /// 新用户注册方法() /// </summary> /// <param name="customer">用户输入的信息集合</param> /// <returns>数据库中受影响的行数,如果大于0,则注册成功!,否则注册失败!</returns> public static int InsertRegist(Model.Regist regist) { //string sql = " insert into Regist([RegistName],[Rpwd],[REmail]) values(@RegistName,@Rpwd,@REmail)"; SqlParameter[] P = { new SqlParameter("@RegistName", regist.RegistName), new SqlParameter("@Rpwd", regist.Rpwd), new SqlParameter("@REmail", regist.REmail), }; return(DBHelper.ExecuteNonQuery("P_AddCustomer", System.Data.CommandType.Text, P)); }
public string getConnStr(Model.Synergismlogdt dt) { DS.DAL.Regist rdal = new Regist(); Model.Regist rmdoel = rdal.GetModel(dt.Accid); if (rmdoel != null) { return(string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID=sa;Password={2};Current Language=Simplified Chinese", rmdoel.Caddress, rmdoel.Caccname, rmdoel.Cdbpwd)); } else { return(""); } }
/// <summary> /// 获取数据库连接信息 /// </summary> public Model.Regist GetModel(string acccode) { Model.Regist model = new Model.Regist(); model.Accid = "1000000002"; model.Acccode = "0000000002"; model.Cservername = ConfigurationManager.AppSettings["u8servername"]; model.Cacc_id = ConfigurationManager.AppSettings["u8acccode"]; //"888"; model.Caccname = ConfigurationManager.AppSettings["dbcatalogname"]; //UFDATA_888_2015 model.Cpassword = ConfigurationManager.AppSettings["u8pwd"]; model.Benable = "1"; model.Cuser_id = ConfigurationManager.AppSettings["u8user"]; model.Cmaker = ConfigurationManager.AppSettings["u8user"]; return(model); }
/// <summary> /// 获取最后登录日期 /// </summary> /// <param name="rmdoel">登录账套信息</param> /// <returns></returns> public static string GetLoginDate(Model.Regist rmdoel) { string strLoginDate = string.Empty; try { if (rmdoel.Dlogindate != null) { strLoginDate = Convert.ToDateTime(rmdoel.Dlogindate).ToString("yyyy-MM-dd").Replace('.', '-').Replace('/', '-'); } } catch { strLoginDate = string.Empty; } if (string.IsNullOrEmpty(strLoginDate) && rmdoel.Ibeginyear >= 1979) { return(TransferDate(rmdoel.Ibeginyear)); } return(strLoginDate); }
public override Model.DealResult UndoMake(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = new Model.DealResult(); Model.APIData apidata = bd as Model.APIData; try { CancelAudit(apidata, dt); } catch (Exception ex) { Log.WriteWinLog("purchaseop_cancelaudit:" + ex.ToString()); dr.ResultNum = -1; dr.ResultMsg = ex.Message; return(dr); } BusinessObject domHead = null; BusinessObject domBody = null; LoadVouch(apidata, dt, out domHead, out domBody); string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id"); U8Login.clsLogin u8Login = new U8Login.clsLogin(); dr = GetU8Login(apidata, u8Login); if (dr.ResultNum < 0) { return(dr); } U8ApiBroker broker = null; dr = GetU8ApiBroker(apidata, u8Login, out broker, "delete"); if (dr.ResultNum < 0) { return(dr); } broker.SetBoParam("domHead", domHead); try { broker.SetBoParam("domBody", domBody); } catch { } MSXML2.IXMLDOMDocument2 CurDom = new MSXML2.DOMDocument(); broker.AssignNormalValue("CurDom", CurDom); if (!broker.Invoke()) { Exception apiEx = broker.GetException(); if (apiEx != null) { if (apiEx is MomSysException) { MomSysException sysEx = apiEx as MomSysException; dr.ResultNum = -1; dr.ResultMsg = "系统异常:" + sysEx.Message; } else if (apiEx is MomBizException) { MomBizException bizEx = apiEx as MomBizException; dr.ResultNum = -1; dr.ResultMsg = "API异常:" + bizEx.Message; } String exReason = broker.GetExceptionString(); if (exReason.Length != 0) { dr.ResultNum = -1; dr.ResultMsg = " 异常原因:" + exReason; } } broker.Release(); return(dr); } System.String result = broker.GetReturnValue() as System.String; if (result != null) { dr.ResultNum = -1; dr.ResultMsg = "API错误:" + result; throw new Exception("API错误:" + result); } broker.Release(); DAL.Regist registdal = new DAL.Regist(); Model.Regist regist = registdal.GetModel(dt.Accid); //acccode 转 accid return(dr); }
/// <summary> /// 获取数据库连接信息 /// </summary> public Model.Regist GetModel(string acccode) { StringBuilder strSql = new StringBuilder(); strSql.Append("select accid, cpassword, caddress, cdbpwd, datasource, cacc_id, caccname, ibeginyear, cuser_id, benable, cmaker, ddate, cmaketime, cmodifer, dmodifydate, cmodifytime, iprintcount, ivtid, acccode, ufts, cremark, cmacadd, dlogindate, cservername "); strSql.Append(" from " + _tableName + " "); strSql.Append(" where acccode='" + acccode + "' "); Model.Regist model = new Model.Regist(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), null); ApiService.BLL.Common.ErrorMsg(ds, "未能取到账套信息"); if (ds.Tables[0].Rows.Count > 0) { model.Accid = ds.Tables[0].Rows[0]["accid"].ToString(); model.Cpassword = ds.Tables[0].Rows[0]["cpassword"].ToString(); model.Benable = ds.Tables[0].Rows[0]["benable"].ToString(); model.Cmaker = ds.Tables[0].Rows[0]["cmaker"].ToString(); if (ds.Tables[0].Rows[0]["ddate"].ToString() != "") { model.Ddate = DateTime.Parse(ds.Tables[0].Rows[0]["ddate"].ToString()); } if (ds.Tables[0].Rows[0]["cmaketime"].ToString() != "") { model.Cmaketime = DateTime.Parse(ds.Tables[0].Rows[0]["cmaketime"].ToString()); } model.Cmodifer = ds.Tables[0].Rows[0]["cmodifer"].ToString(); if (ds.Tables[0].Rows[0]["dmodifydate"].ToString() != "") { model.Dmodifydate = DateTime.Parse(ds.Tables[0].Rows[0]["dmodifydate"].ToString()); } if (ds.Tables[0].Rows[0]["cmodifytime"].ToString() != "") { model.Cmodifytime = DateTime.Parse(ds.Tables[0].Rows[0]["cmodifytime"].ToString()); } if (ds.Tables[0].Rows[0]["iprintcount"].ToString() != "") { model.Iprintcount = int.Parse(ds.Tables[0].Rows[0]["iprintcount"].ToString()); } model.Ivtid = ds.Tables[0].Rows[0]["ivtid"].ToString(); model.Acccode = ds.Tables[0].Rows[0]["acccode"].ToString(); model.Cremark = ds.Tables[0].Rows[0]["cremark"].ToString(); model.Caddress = ds.Tables[0].Rows[0]["caddress"].ToString(); model.Cdbpwd = ds.Tables[0].Rows[0]["cdbpwd"].ToString(); model.Datasource = ds.Tables[0].Rows[0]["datasource"].ToString(); model.Cacc_id = ds.Tables[0].Rows[0]["cacc_id"].ToString(); model.Caccname = ds.Tables[0].Rows[0]["caccname"].ToString(); if (ds.Tables[0].Rows[0]["ibeginyear"].ToString() != "") { model.Ibeginyear = int.Parse(ds.Tables[0].Rows[0]["ibeginyear"].ToString()); } model.Cuser_id = ds.Tables[0].Rows[0]["cuser_id"].ToString(); model.Cmacadd = ds.Tables[0].Rows[0]["cmacadd"].ToString(); if (ds.Tables[0].Rows[0]["dlogindate"].ToString() != "") { DateTime date = DateTime.Parse(ds.Tables[0].Rows[0]["dlogindate"].ToString()); if (date.Year <= 2000 || date.Year >= 2050) { model.Dlogindate = null; } else { model.Dlogindate = date; } } else { model.Dlogindate = null; } model.Cservername = ds.Tables[0].Rows[0]["cservername"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 新用户注册方法 /// </summary> /// <param name="regist"></param> /// <returns></returns> public static int InsertRegist(Model.Regist regist) { return(DAL.RgistDAL.InsertRegist(regist)); }