Exemplo n.º 1
0
    public override bool ChangePassword(string username, string oldPassword, string newPassword)
    {
        ECountBasePage p = new ECountBasePage();

        SGM.ECount.DataModel.User user = p.Service.GetUserbyName(username);
        if (user == null || user.Password != oldPassword || newPassword.IndexOf(username) != -1)
        {
            return(false);
        }
        else
        {
            //SGM.ECount.DataModel.User newUser = new SGM.ECount.DataModel.User();
            //newUser.UserID = user.UserID;
            //newUser.UserName = user.UserName;
            //newUser.UserGroup = user.UserGroup;
            //newUser.Password = newPassword;
            //newUser.Available = user.Available;
            //newUser.ConsignmentDUNS = user.ConsignmentDUNS;
            //newUser.CreateDate = user.CreateDate;
            //newUser.DUNS = user.DUNS;
            //newUser.Plant = user.Plant;
            //newUser.RepairDUNS = user.RepairDUNS;
            //newUser.Segment = user.Segment;
            //newUser.Workshop = user.Workshop;
            //p.Service.UpdateUser(newUser);
            user.Password     = newPassword;
            user.LastModified = DateTime.Now;
            p.Service.UpdateUser(user);
            return(true);
        }
    }
Exemplo n.º 2
0
    protected void valiCounts_ServerValidate(object source, ServerValidateEventArgs args)
    {
        SGM.ECount.DataModel.User user = Service.GetUserbyKey(CurrentUser.UserInfo);
        int maxCount;
        int currentCount;

        if (ddlIsStatic.SelectedIndex > 0)
        {
            maxCount     = user.UserGroup.MaxDynamicStocktake.Value;
            currentCount = user.UserGroup.CurrentDynamicStocktake.Value;
        }
        else
        {
            maxCount     = user.UserGroup.MaxStaticStocktake.Value;
            currentCount = user.UserGroup.CurrentStaticStocktake.Value;
        }
        if (Details.Count + currentCount - OriginDetailCount > maxCount)
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
        //Details.Count
        //if (user.UserGroup.MaxStaticStocktake)
        //{

        //}
    }
Exemplo n.º 3
0
    public override bool ValidateUser(string username, string password)
    {
        ECountBasePage p = new ECountBasePage();

        SGM.ECount.DataModel.User user = p.Service.GetUserbyName(username);
        if (user == null || !user.Available)
        {
            return(false);
        }
        if (user.Password != password)
        {
            if (user.RetryTimes >= 5)
            {
                user.Available = false;
                p.Service.UpdateUser(user);
            }
            else
            {
                user.RetryTimes += 1;
                p.Service.UpdateUser(user);
            }
            return(false);
        }
        else
        {
            System.Web.HttpContext.Current.Session["ECountUser"] = user;
            //ECountIdentity identity = new ECountIdentity(user);
            //ECountPrincipal principal = new ECountPrincipal(identity);
            //Thread.CurrentPrincipal = principal;
            //System.Web.HttpContext.Current.User = principal;
            user.RetryTimes = 0;
            user.LastLogon  = DateTime.Now;
            p.Service.UpdateUser(user);
            return(true);
        }
    }
Exemplo n.º 4
0
    //protected void linkDelete_Click(object sender, EventArgs e)
    //{
    //    Details.Clear();
    //    BindDataControl(gvRequestParts, Details);
    //    pagerRequestParts.TotalRecord = 0;
    //    pagerRequestParts.CurrentPage = 1;
    //    if (RequestID != null)
    //    {
    //        NewStocktakeRequest request = new NewStocktakeRequest
    //        {
    //            Details = new List<NewStocktakeDetails>()
    //        };
    //        Service.UpdateCachedRequest(request, CacheKey, false, true);
    //    }
    //    if (gvParts.DataKeys[0].Value != null)
    //    {
    //        Query();
    //    }
    //}
    protected void valiCounts_ServerValidate(object source, ServerValidateEventArgs args)
    {
        SGM.ECount.DataModel.User user = CurrentUser.UserInfo;//Service.GetUserbyKey(CurrentUser.UserInfo);
        int          maxUserCount;
        int          currentCount;
        int          maxCount;
        int          currentAmount = 0;
        DropDownList ddlIsStatic   = dlRequest.Items[0].FindControl("ddlIsStatic") as DropDownList;

        if (ddlIsStatic.SelectedIndex > 0)
        {
            BizParams param = BizParamsList.Find(p => p.ParamKey == "MaxDynamic");
            maxCount      = int.Parse(param.ParamValue);
            maxUserCount  = user.UserGroup.MaxDynamicStocktake ?? 0;
            currentCount  = user.UserGroup.CurrentDynamicStocktake.Value;
            currentAmount = CurrentDynAmount;
            currentAmount = currentAmount - currentCount;
        }
        else
        {
            BizParams param = BizParamsList.Find(p => p.ParamKey == "MaxStatic");
            maxCount     = int.Parse(param.ParamValue);
            maxUserCount = user.UserGroup.MaxStaticStocktake.Value;

            currentCount  = user.UserGroup.CurrentStaticStocktake.Value;
            currentAmount = CurrentStAmount;
            currentAmount = currentAmount - currentCount;
        }

        int newPartsCount = 0;

        if (gvParts.DataKeys[0].Value != null)
        {
            //List<View_StocktakeDetails> newDetails = NewDetails;

            for (int i = 0; i < gvParts.Rows.Count; i++)
            {
                if (gvParts.DataKeys[i] != null)
                {
                    CheckBox cbSelect = gvParts.Rows[i].FindControl("cbSelect") as CheckBox;
                    if (cbSelect != null)//add selected item
                    {
                        int partID = (int)gvParts.DataKeys[i].Value;
                        if (cbSelect.Checked)
                        {
                            newPartsCount++;
                        }
                    }
                }
            }
        }

        currentCount += newPartsCount + RequestedDetails.Count; // ((OriginDetailCount == null) ? 0 : OriginDetailCount.Value);
        if (currentCount > maxUserCount)
        {
            valiCounts.Text = "已超过当前用户盘点数量上限!";
            args.IsValid    = false;
        }
        else
        {
            currentCount += currentAmount;
            if (currentCount > maxCount)
            {
                valiCounts.Text = "已超过盘点数量上限!";
                args.IsValid    = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
Exemplo n.º 5
0
 public void UpdateUser(SGM.ECount.DataModel.User user)
 {
     Channel.UpdateUser(user);
 }