Exemplo n.º 1
0
    public string GetReferUserType(string EmployeeID)
    {
        string result      = string.Empty;
        OSUSER oOSUSERType = obDBCtxt.OSUSERs.FirstOrDefault(t => t.EMPLOYEEID == EmployeeID && t.ISACTIVE);

        if (oOSUSERType != null)
        {
            result = oOSUSERType.USERTYPE.ToString();
        }
        return(result);
    }
    private void SetReferInfo(string ReferenceNo)
    {
        List <vwReferCaseList> CaseList = null;

        btnSuspSave.Enabled = true;
        OSSearchHistory oOSSearchHistoryTemp = obDBCtxt.OSSearchHistories.FirstOrDefault(t => t.SearchRefNo == ReferenceNo);

        if (oOSSearchHistory.OSREFERINFOes.Count > 0)
        {
            OSUSER oOSUSERInitiator = new OSUSER();
            oOSUSERInitiator.EMPLOYEEID = oOSSearchHistory.EmployeeID;
            oOSUSERInitiator.DETAILINFO = oOSUSERInitiator.EMPLOYEEID + " - INITIATOR";
            CaseList = obDBCtxt.vwReferCaseLists.Where(t => t.SearchRefNo == ReferenceNo).ToList();
            obDBCtxt.Refresh(RefreshMode.StoreWins, CaseList);
            string currentUserId = Session["CurrentUser"].ToString().Trim();
            if (oOSSearchHistory.OSREFERINFOes.OrderByDescending(t => t.ID).First().REFERFROM != currentUserId && oOSSearchHistory.EmployeeID != currentUserId)
            {
                Int32 CaMelCoUserType  = Convert.ToInt32(Enumaretion.SanctionUserType.DeputyCAMELCO);
                Int32 CaMelCoUserType1 = Convert.ToInt32(Enumaretion.SanctionUserType.CAMELCO);
                var   oReferUserList   = obDBCtxt.OSUSERs.Where(t => (t.USERTYPE == CaMelCoUserType || t.USERTYPE == CaMelCoUserType1) && t.ISACTIVE).Distinct().ToList();
                oReferUserList.Add(oOSUSERInitiator);
                UIUtility.FillCombo(ddlReferTo, "DETAILINFO", "EMPLOYEEID", oReferUserList, true, false);
                ddlRefStatus.Items.RemoveAt(1);
                ddlRefStatus.SelectedIndex = 1;//to inititate a request in value 1
                ddlRefStatus.Enabled       = true;
            }
            else
            {
                Int32 ReferApprvCode = Convert.ToInt32(Enumaretion.ReferStatus.Approve);
                if (oOSSearchHistory.OSREFERINFOes.OrderByDescending(t => t.ID).First().REFERSTATUS == ReferApprvCode && oOSSearchHistory.EmployeeID == currentUserId && oOSSearchHistory.IsOpen == true)
                {
                    txtACOpen.Enabled = true;

                    btnSuspSave.Enabled    = true;
                    ddlReferTo.Enabled     = false;
                    ddlRefStatus.Enabled   = false;
                    referStatusVal.Enabled = false;
                    referToVal.Enabled     = false;
                }
                else
                {
                    txtACOpen.Enabled    = false;
                    btnSuspSave.Enabled  = false;
                    ddlReferTo.Enabled   = false;
                    ddlRefStatus.Enabled = false;
                }
                txtACOpen.Text = (!string.IsNullOrEmpty(oOSSearchHistory.ACOpenBy)) ? oOSSearchHistory.ACOpenBy.Trim() : string.Empty;
            }
        }
        else
        {
            Int32 UserType       = Convert.ToInt32(Enumaretion.SanctionUserType.BAMELCO);
            var   oReferUserList = obDBCtxt.OSUSERs.Where(t => t.USERTYPE == UserType && t.ISACTIVE).Distinct().ToList();
            UIUtility.FillCombo(ddlReferTo, "DETAILINFO", "EMPLOYEEID", oReferUserList, true, false);
            ddlRefStatus.SelectedIndex = 1;//to inititate a request in value 1
            txtACOpen.Text             = string.Empty;
            ddlRefStatus.Enabled       = false;
            ddlReferTo.Enabled         = true;
        }

        gvCaseInfo.DataSource = CaseList;
        gvCaseInfo.DataBind();
    }