예제 #1
0
 private void txtSourceORAgent_ButtonCustomClick(object sender, EventArgs e)
 {
     if (txtSourceORAgent.WatermarkText == "Select Source")
     {
         frmComboList objfrmComboList = new frmComboList(); //Custom Designed Combobox replacement
         objfrmComboList.TitleText = "Select source";
         objfrmComboList.dtItems   = dtImportSources;
         objfrmComboList.lstColumnsToDisplay.Add("PicklistValue");
         objfrmComboList.sColumnToSearch       = "PicklistValue";
         objfrmComboList.IsMultiSelect         = false;
         objfrmComboList.IsSingleWordSelection = false;
         objfrmComboList.IsSpellCheckEnabeld   = false;
         //objfrmComboList.ShowDialog(this);
         if (DialogResult.OK == objfrmComboList.ShowDialog(this))
         {
             txtImportSource.Text = objfrmComboList.sReturn.Trim();
         }
     }
     else
     {
         frmComboList objfrmComboList = new frmComboList(); //Custom Designed Combobox replacement
         objfrmComboList.TitleText = "Select Agent Name";
         objfrmComboList.dtItems   = dtEmails.DefaultView.ToTable(true, "CREATED_BY");;
         objfrmComboList.lstColumnsToDisplay.Add("CREATED_BY");
         objfrmComboList.sColumnToSearch       = "CREATED_BY";
         objfrmComboList.IsMultiSelect         = false;
         objfrmComboList.IsSingleWordSelection = false;
         objfrmComboList.IsSpellCheckEnabeld   = false;
         if (DialogResult.OK == objfrmComboList.ShowDialog(this))
         {
             txtSourceORAgent.Text = objfrmComboList.sReturn.Trim();
             LoadGrid(dtEmails);
         }
     }
 }
예제 #2
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            //StyleManager.MetroColorGeneratorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(ColorScheme.GetColor("0E6D80"), ColorScheme.GetColor("0E6D80"));
            frmComboList objFrmComboList = new frmComboList();
            DataTable    dtAllUsers      = GV.MSSQL.BAL_FetchTable("Timesheet..Users", "Active='Y'");//All active time logger users;

            objFrmComboList.FormBorderStyle = FormBorderStyle.FixedSingle;
            objFrmComboList.TitleText       = "Select User";

            if (sMoniterUsersEmpID.Length > 0 && dtAllUsers.Select("EMPLOYEENO NOT IN (" + sMoniterUsersEmpID + ")").Length > 0)
            {
                objFrmComboList.dtItems = dtAllUsers.Select("EMPLOYEENO NOT IN (" + sMoniterUsersEmpID + ")").CopyToDataTable();
            }
            else if (sMoniterUsersEmpID.Length == 0)
            {
                objFrmComboList.dtItems = dtAllUsers;
            }
            else
            {
                objFrmComboList.dtItems = null;
            }

            objFrmComboList.lstColumnsToDisplay.Add("UserName");
            objFrmComboList.sColumnToSearch       = "UserName";
            objFrmComboList.IsSpellCheckEnabeld   = false;
            objFrmComboList.IsMultiSelect         = true;
            objFrmComboList.IsSingleWordSelection = false;
            objFrmComboList.StartPosition         = FormStartPosition.CenterScreen;
            //objFrmComboList.ShowInTaskbar = false;
            objFrmComboList.MinimizeBox = false;
            objFrmComboList.MaximizeBox = false;
            objFrmComboList.ShowDialog(this);
            if (objFrmComboList.sReturn != null && objFrmComboList.sReturn.Length > 0)
            {
                DataRow[] drrSelectedUsers = dtAllUsers.Select("USERNAME IN('" + objFrmComboList.sReturn.Replace("|", "','") + "')");
                if (drrSelectedUsers.Length > 0)
                {
                    if (DialogResult.Yes == MessageBoxEx.Show("Are you sure to add these selected users to watchlist ?", "e-Monitor", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        string sEMPs = GM.ColumnToQString("EMPLOYEENO", drrSelectedUsers.CopyToDataTable(), "String");
                        GV.MSSQL1.BAL_ExecuteQuery("INSERT INTO RM..EMoniter (EMPLOYE_NAME, EMPLOYE_ID) SELECT Fullname, EmployeeNo FROM CH1020BD02.Timesheet.dbo.Users WHERE Active = 'Y' AND EmployeeNo IN(" + sEMPs + ") AND EmployeeNo NOT in (SELECT EMPLOYE_ID from RM..Emoniter);");
                        GV.MSSQL1.BAL_ExecuteQuery("INSERT into RM..EMonitor_Users (EMPLOYEID, EMONITORID) Select '" + GV.sEmployeeNo + "', ID from RM..EMoniter WHERE EMPLOYE_ID IN(" + sEMPs + ") AND ID NOT IN(SELECT EMONITORID FROM RM..EMonitor_Users WHERE EMPLOYEID = '" + GV.sEmployeeNo + "')");
                        ToastNotification.Show(this, "Users added to watch list.", eToastPosition.TopRight);
                        //DataTable dtDuplicateUsers = GV.MSSQL.BAL_ExecuteQuery("Select * from Emoniter where EMPLOYEID IN (" + sEMPs + ")");
                        //if(dtDuplicateUsers.Rows.Count > 0)
                        //{

                        //}
                        //else
                        //{

                        Load();
                        //}
                    }
                }
            }
        }
예제 #3
0
        private void txtImportSource_ButtonCustomClick(object sender, EventArgs e)
        {
            frmComboList objfrmComboList = new frmComboList(); //Custom Designed Combobox replacement

            objfrmComboList.TitleText = "Select source";
            objfrmComboList.dtItems   = dtImportSources;
            objfrmComboList.lstColumnsToDisplay.Add("PicklistValue");
            objfrmComboList.sColumnToSearch       = "PicklistValue";
            objfrmComboList.IsMultiSelect         = false;
            objfrmComboList.IsSingleWordSelection = false;
            objfrmComboList.IsSpellCheckEnabeld   = false;
            objfrmComboList.ShowDialog(this);
            txtImportSource.Text = objfrmComboList.sReturn.Trim();
        }
예제 #4
0
 private void mnuaddNewAgents_Click(object sender, EventArgs e)//Add new agents from Timesheet..Users
 {
     try
     {
         frmComboList objFrmComboList = new frmComboList();
         string[]     sNewAgentList;
         //objFrmComboList.ShowInTaskbar = false;
         objFrmComboList.TitleText = "Select Agent Name";
         objFrmComboList.dtItems   = dtAllUsers;
         objFrmComboList.lstColumnsToDisplay.Add("UserName");
         objFrmComboList.sColumnToSearch       = "UserName";
         objFrmComboList.IsSpellCheckEnabeld   = false;
         objFrmComboList.IsMultiSelect         = true;
         objFrmComboList.IsSingleWordSelection = false; //Single word selection overrides Multiselect property(Which only Single word can be selected from list)
         objFrmComboList.ShowDialog(this);
         sNewAgentList = objFrmComboList.sReturn.Split('|');
         if (sNewAgentList.Length > 0)
         {
             foreach (string sName in sNewAgentList)
             {
                 if (sName.Trim().Length > 0)
                 {
                     DataRow[] drAgentExistenceCheck = dtFilterAssignment.Select("USERNAME = '******'");//Check if the agent already exist in current FilterAssignment Table
                     if (drAgentExistenceCheck.Length == 0)
                     {
                         DataRow dr = dtFilterAssignment.NewRow();
                         dr["PROJECT_ID"]   = GV.sProjectID;
                         dr["USERNAME"]     = sName;
                         dr["USERACCESS"]   = GV.sAccessTo;
                         dr["CREATED_DATE"] = GM.GetDateTime();
                         dr["CREATED_BY"]   = GV.sEmployeeName;
                         dtFilterAssignment.Rows.Add(dr);
                     }
                 }
             }
             DGV_Insert_Update_Delete();//Add new agents to DB
         }
     }
     catch (Exception ex)
     {
         GM.Error_Log(System.Reflection.MethodBase.GetCurrentMethod(), ex, true, true);
         //MessageBoxEx.Show(ex.Message, "Campaign Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #5
0
        private void addUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                frmComboList objFrmComboList = new frmComboList();
                objFrmComboList.TitleText = "Select User";
                objFrmComboList.dtItems   = dtAllUsers;
                objFrmComboList.lstColumnsToDisplay.Add("UserName");
                objFrmComboList.sColumnToSearch     = "UserName";
                objFrmComboList.IsSpellCheckEnabeld = false;
                objFrmComboList.IsMultiSelect       = true;
                objFrmComboList.ShowDialog(this);

                if (objFrmComboList.sReturn != null && objFrmComboList.sReturn.Length > 0)
                {
                    List <string> lstUsers = new List <string>();
                    lstUsers = objFrmComboList.sReturn.Split('|').ToList();
                    foreach (string sUserName in lstUsers)
                    {
                        if (dtGCCUsers.Select(String.Format("UserName = '******'", sUserName)).Length == 0)
                        {
                            DataRow dr = dtGCCUsers.NewRow();
                            dr["UserName"]     = sUserName;
                            dr["USERTYPE"]     = "Agent";
                            dr["USERACCESS"]   = GV.sAccessTo;
                            dr["CREATED_BY"]   = GV.sEmployeeName;
                            dr["CREATED_DATE"] = GM.GetDateTime();
                            dtGCCUsers.Rows.Add(dr);
                        }
                    }
                    dgvUser.DataSource = dtGCCUsers;
                    UpdateTable();
                }
            }
            catch (Exception ex)
            {
                GM.Error_Log(System.Reflection.MethodBase.GetCurrentMethod(), ex, true, true);
                //MessageBoxEx.Show(ex.Message, "Campaign Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }