public static UserInfo ReadUserInfo() { string userno = ReadCookie("userinfo"); UserInfo model = new UserInfo(); if (!string.IsNullOrEmpty(userno)) { User_DB _db = new User_DB(); model = _db.GetModelByFilterByUserNo(userno); T_WareHouse_Func twfun = new T_WareHouse_Func(); List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>(); if (twfun.GetModelListBySql(model, ref lstWarehouse)) { model.lstWarehouse = lstWarehouse; } return(model); } else { return(null); } }
public bool UserLogin(ref UserInfo user, ref string strError) { try { UserInfo model; User_DB _db = new User_DB(); DateTime CurrentTime; model = _db.GetModelBySql(user); if (model == null) { int iSucc = _db.GetScalarBySql(user); if (iSucc <= 0) { strError = "该用户不存在,请检查大小写是否输入正确!"; return(false); } else { strError = "密码输入错误,忘记密码请联系管理员重置!"; return(false); } } CurrentTime = model.CurrentTime; if (model.UserStatus == 2) { strError = string.Format("用户【{0}】已停用", model.UserName); return(false); } if (model.IsDel == 2) { strError = string.Format("用户【{0}】已删除", model.UserName); return(false); } user = model; T_UserGroup_Func ugf = new T_UserGroup_Func(); List <T_UserGroupInfo> lstGroup = new List <T_UserGroupInfo>(); if (ugf.GetModelListBySql(user, ref lstGroup)) { user.lstUserGroup = lstGroup; } T_MENU_Func tmfun = new T_MENU_Func(); List <T_MenuInfo> lstMenu = new List <T_MenuInfo>(); if (tmfun.GetModelListBySql(user, ref lstMenu, true)) { //user.lstMenu = lstMenu.Where(t => t.MenuType <= 3).ToList(); lstMenu = lstMenu.Where(t => t.MenuType == 1 && t.MenuStatus == 1 && t.IsChecked == true).ToList(); var lstMenuParent = lstMenu.Where(t => t.ParentID == 0).OrderBy(t => t.NodeSort).ToList(); foreach (var item in lstMenuParent) { item.lstSubMenu = lstMenu.FindAll(t => t.ParentID == item.ID); } user.lstMenu = lstMenuParent; } T_WareHouse_Func twfun = new T_WareHouse_Func(); List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>(); if (twfun.GetModelListBySql(user, ref lstWarehouse)) { user.lstWarehouse = lstWarehouse; } return(true); } catch (Exception ex) { strError = ex.Message + ex.StackTrace; return(false); } }
public string GetWareHouseByUserADF(string UserNo) { BaseMessage_Model <UserInfo> messageModel = new BaseMessage_Model <UserInfo>(); try { UserInfo model; User_DB _db = new User_DB(); if (string.IsNullOrEmpty(UserNo)) { messageModel.Message = "传入用户编号为空!"; messageModel.HeaderStatus = "E"; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } model = _db.GetModelByFilterByUserNo(UserNo); if (model == null) { messageModel.Message = "该用户不存在,请检查大小写是否输入正确!"; messageModel.HeaderStatus = "E"; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } if (model.UserStatus == 2) { messageModel.Message = string.Format("用户【{0}】已停用", model.UserName); messageModel.HeaderStatus = "E"; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } if (model.IsDel == 2) { messageModel.Message = string.Format("用户【{0}】已删除", model.UserName); messageModel.HeaderStatus = "E"; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } T_WareHouse_Func twfun = new T_WareHouse_Func(); List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>(); if (twfun.GetModelListBySql(model, ref lstWarehouse)) { model.lstWarehouse = lstWarehouse; } messageModel.Message = "仓库获取成功!"; messageModel.HeaderStatus = "S"; messageModel.ModelJson = model; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } catch (Exception ex) { messageModel.Message = ex.Message; messageModel.HeaderStatus = "E"; return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel)); } }
protected override bool CheckModelBeforeSave(UserInfo model, ref string strError) { if (model == null) { strError = "客户端传来的实体类不能为空!"; return(false); } if (model.UserStatus <= 0) { strError = "用户状态必须选择!"; return(false); } if (model.UserType <= 0) { strError = "用户类型必须选择!"; return(false); } if (BILBasic.Common.Common_Func.IsNullOrEmpty(model.UserNo)) { strError = "登录名不能为空!"; return(false); } if (Common_Func.IsNullOrEmpty(model.UserName)) { strError = "用户姓名不能为空!"; return(false); } if (Common_Func.IsNullOrEmpty(model.PassWord) || Common_Func.IsNullOrEmpty(model.RePassword)) { strError = "登陆密码和确认密码不能为空!"; return(false); } //判断据点和仓库的关系 T_WareHouse_Func Wfunc = new T_WareHouse_Func(); string Msg = ""; string[] warehousenos = model.WarehouseCode.Split(','); for (int i = 0; i < warehousenos.Length; i++) { T_WareHouseInfo warehouse = new T_WareHouseInfo() { ID = Convert.ToInt16(warehousenos[i]) }; Wfunc.GetModelByID(ref warehouse, ref Msg); if (model.StrongHoldCode == "0300") { if (warehouse.WareHouseNo.Substring(0, 1) != "G") { strError = "仓库和据点没有对应关系!"; return(false); } } if (model.StrongHoldCode == "0401") { if (warehouse.WareHouseNo.Substring(0, 2) != "C1") { strError = "仓库和据点没有对应关系!"; return(false); } } if (model.StrongHoldCode == "0402") { if (warehouse.WareHouseNo.Substring(0, 2) != "C2") { strError = "仓库和据点没有对应关系!"; return(false); } } if (model.StrongHoldCode == "0403") { if (warehouse.WareHouseNo.Substring(0, 2) != "C3") { strError = "仓库和据点没有对应关系!"; return(false); } } } //if (Common_Func.IsNullOrEmpty(model.GroupCode)) //{ // strError = "用户分组不能为空!"; // return false; //} if (!Common_Func.IsEqualString(model.PassWord, model.RePassword)) { strError = "确认密码与登陆密码不一致!"; return(false); } return(true); }
protected override string GetFilterSql(UserModel user, T_OutStockTaskInfo model) { string strUserNo = string.Empty; string strSerialNo = string.Empty; string strSql = base.GetFilterSql(user, model); string strAnd = " and "; if (model.Status > 0) { if (model.PcOrPda == 1)//PC请求 { strSql += strAnd; strSql += "isnull(status,1)= '" + model.Status + "'"; } else { if (model.Status == 1 || model.Status == 2) { strSql += strAnd; strSql += "( status=1 or status=2 )"; } else { strSql += strAnd; strSql += "status= '" + model.Status + "'"; } } } if (!string.IsNullOrEmpty(model.SupcusCode)) { strSql += strAnd; strSql += " (SupcusCode Like '" + model.SupcusCode + "%' or SUPCUSNAME Like '" + model.SupcusCode + "%' )"; } if (model.DateFrom != null) { strSql += strAnd; strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.ToOracleTimeString() + " "; } if (model.DateTo != null) { strSql += strAnd; strSql += " CreateTime <= " + model.DateTo.ToDateTime().Date.AddDays(1).ToOracleTimeString() + " "; } if (!string.IsNullOrEmpty(model.TaskNo)) { strSql += strAnd; strSql += " (taskno Like '%" + model.TaskNo + "%' )"; } if (model.VoucherType > 0) { strSql += strAnd; strSql += " VoucherType ='" + model.VoucherType + "'"; } if (!string.IsNullOrEmpty(model.ErpVoucherNo)) { //同步单据 string strMsg = ""; ParamaterFiled_DB PDB = new ParamaterFiled_DB(); PDB.GetVoucherNo(model.ErpVoucherNo, ref strMsg, "2"); strSql += strAnd; strSql += " ErpVoucherNo like '%" + model.ErpVoucherNo.Trim() + "%'"; } //if (!string.IsNullOrEmpty(model.PickLeaderUserNo)) //{ // strSql += strAnd; // strSql += " Pickleaderuserno like '" + GetUserNo(model.PickLeaderUserNo) + "%'"; //} //if (!string.IsNullOrEmpty(model.PickUserNo)) //{ // strSql += strAnd; // strSql += " ID in (select taskid from t_Taskpick where Pickuserno like '" + GetUserNo(model.PickUserNo) + "%')"; //} if (!string.IsNullOrEmpty(model.StrongHoldCode)) { strSql += strAnd; strSql += " (StrongHoldCode like '" + model.StrongHoldCode + "%' )"; } if (!string.IsNullOrEmpty(model.StrongHoldName)) { strSql += strAnd; strSql += " (StrongHoldName like '" + model.StrongHoldName + "%' )"; } if (!user.UserNo.Equals("admin")) { strSql += strAnd; string strwarehouse = "warehouseno in ("; T_WareHouse_Func twfun = new T_WareHouse_Func(); List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>(); UserInfo userInfo = new UserInfo { UserNo = user.UserNo, ID = user.ID }; if (twfun.GetModelListBySql(userInfo, ref lstWarehouse)) { if (lstWarehouse.Count > 0) { foreach (var item in lstWarehouse) { strwarehouse = (strwarehouse + "'" + item.WareHouseNo + "',"); } strwarehouse = strwarehouse.Substring(0, strwarehouse.Length - 1); strwarehouse = (strwarehouse + ")"); } else { strwarehouse = "1=2 "; } } //StrongHoldCode = '" + user.StrongHoldCode + "' and strSql += " (" + strwarehouse + " or isnull(fromerpwarehouse,'')='')"; } if (model.WareHouseID > 0) { strSql += strAnd; strSql += " warehouseid = '" + model.WareHouseID + "' "; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql += strAnd; strSql += " id in ( SELECT HEADERID FROM v_Outtaskdetail WHERE MATERIALNO LIKE '%" + model.MaterialNo + "%' ) "; } if (!string.IsNullOrEmpty(model.VouUser)) { strSql += strAnd; strSql += " VouUser like '" + model.VouUser + "%' "; } if (!string.IsNullOrEmpty(model.CarNo)) { strSql += strAnd; strSql += " taskno = ( select taskno from t_pickcar where carno = '" + model.CarNo + "' ) "; } if (!string.IsNullOrEmpty(model.BarCode)) { strSerialNo = OutBarCode.OutBarCode_DeCode.GetEndSerialNo(model.BarCode); strSql += strAnd; strSql += " taskno = ( select a.Taskno from v_Outtaskdetail a where a.id = (select a.Taskdetailesid from t_stock a where a.Serialno = '" + strSerialNo + "') )"; } if (model.PcOrPda != 1) { strSql += strAnd; strSql += " id in (select headerid from t_Taskdetails a where a.Fromerpwarehouse = '" + user.WarehouseCode + "' or a.Fromerpwarehouse is null) "; } if (model.TaskType > 0) { if (model.TaskType == 4) { strSql += strAnd; strSql += " ( tasktype = 2 or tasktype =3 ) "; } else { strSql += strAnd; strSql += " tasktype = '" + model.TaskType.ToInt32() + "' "; } } //strSql += strAnd; //strSql += " tasktype = 2 "; return(strSql);//+ " order by id "; }
public bool UpdateT_WareHouseStatus(UserInfo user, ref T_WareHouseInfo t_warehouse, int NewStatus, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.UpdateModelStatus(user, ref t_warehouse, NewStatus, ref strError)); }
public bool GetAllT_WareHouseByHeaderID(ref List <T_WareHouseInfo> modelList, int headerID, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.GetModelListByHeaderID(ref modelList, headerID, ref strError)); }
public bool GetT_WareHouseListByPage(ref List <T_WareHouseInfo> modelList, UserInfo user, T_WareHouseInfo t_warehouse, ref DividPage page, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.GetModelListByPage(ref modelList, user, t_warehouse, ref page, ref strError)); }
public bool GetT_WareHouseByID(ref T_WareHouseInfo model, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.GetModelByID(ref model, ref strError)); }
public bool DeleteT_WareHouseByModel(UserInfo user, T_WareHouseInfo model, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.DeleteModelByModel(user, model, ref strError)); }
public bool SaveT_WareHouse(UserInfo user, ref T_WareHouseInfo t_warehouse, ref string strError) { T_WareHouse_Func tfunc = new T_WareHouse_Func(); return(tfunc.SaveModelToDB(user, ref t_warehouse, ref strError)); }