protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             string logonName = SharedRules.LogonName();
             vs_CurrentUserLoginName = logonName;
             vs_CurrentUserID        = SharedRules.FindUserID(logonName, this.Page);
             if (string.IsNullOrEmpty(vs_CurrentUserID))
             {
                 vs_CurrentUserID = Request.QueryString["USERID"] != null
                     ? Request.QueryString["USERID"].ToString()
                     : "5050108";
             }
             InitialData();
             Extension.GetDepartmentData(Page);
             Extension.GetEmployeeData(Page);
             Extension.GetPositionData(Page);
         }
         catch (Exception ex)
         {
         }
     }
 }
Esempio n. 2
0
        private void setK2WorkCount()
        {
            string _ConnectionString = "";
            string logonName         = SharedRules.LogonName();

            string currentUserID = SharedRules.FindUserID(logonName, this.Page);

            if (string.IsNullOrEmpty(currentUserID))
            {
                currentUserID = Request.QueryString["USERID"] != null
                    ? Request.QueryString["USERID"].ToString()
                    : "5050108";
            }

            DataTable dtDb = Extension.GetDataTable("SiteSetting");
            {
                if (!dtDb.DataTableIsNullOrEmpty())
                {
                    _ConnectionString = dtDb.Rows[0]["Value"].ToString();
                }
            }
            DataClassesDataAccessDataContext db = new DataClassesDataAccessDataContext(_ConnectionString);
            List <TRNDocument> listDocument     = db.TRNDocuments.Where(x => x.WaitingFor.Contains(currentUserID)).ToList();
            string             counter          = (listDocument.Count() > 999 ? 999 : listDocument.Count()).ToString();

            lbl_WorklistCounter.Text = counter;
        }
        protected void InitialData()
        {
            DataClassesDataAccessDataContext db = new DataClassesDataAccessDataContext(Extension.GetDBConnectionString());

            vs_isDocSetCreated = false;
            vs_isAttach        = false;
            vs_isITAdmin       = false;

            string spGroup = "Admin_ITEdoc";

            if (!string.IsNullOrEmpty(spGroup))
            {
                List <string> userList = SharedRules.GetAllUserInGroup(spGroup);
                DataTable     dtEmp    = Extension.GetEmployeeData(this.Page).Copy();
                if (!dtEmp.DataTableIsNullOrEmpty())
                {
                    foreach (string user in userList)
                    {
                        if (vs_CurrentUserID == SharedRules.FindUserID(user, this.Page))
                        {
                            vs_isITAdmin = true;
                            break;
                        }
                    }
                }
            }

            // Initial Login user as an Approver
            hdn_ApproverID.Value = vs_CurrentUserID;
            if (!string.IsNullOrWhiteSpace(hdn_ApproverID.Value))
            {
                var emp = Extension.GetSpecificEmployeeFromTemp(Page, vs_CurrentUserID);
                var dep = emp.RESULT.First();
                lbl_Approver.Text = string.Format("{0}{1} {2}", emp.PREFIX_TH, emp.FIRSTNAME_TH, emp.LASTNAME_TH);
            }
            //if not Admin_ITEDoc
            if (!vs_isITAdmin)
            {
                lkb_SearchApprover.Enabled = false;
            }

            vs_DocTypeTable = SharedRules.GetList("MstDocumentType", @"<View><Query><Where><And><Eq><FieldRef Name='IsActive' /><Value Type='Boolean'>1</Value></Eq><Eq><FieldRef Name='Level' /><Value Type='Number'>0</Value></Eq></And></Where></Query></View>");

            gv_DelegateByDocType.DataSource = new List <string>();
            gv_DelegateByDocType.DataBind();
            BindingDelegateGV();
        }