示例#1
0
        private bool CheckTicketIdPrivilege(string ticketId)
        {
            decimal?staffTypeId   = StaffBiz.GetStaffType(HttpContext.Current.User.Identity.Name);
            string  staff_type_id = staffTypeId != null?staffTypeId.Value.ToString() : "";

            string username = HttpContext.Current.User.Identity.Name;

            if (!RoleBiz.CheckTicketIdPrivilege(ticketId, username, AppUtil.GetRecursiveStaff(username), AppUtil.GetRecursiveTeam(username), staff_type_id))
            {
                string message       = "ข้อมูลผู้มุ่งหวังรายนี้ ท่านไม่มีสิทธิในการมองเห็น";
                string lastOwnerName = LeadBiz.GetLastOwnerName(ticketId);

                if (!string.IsNullOrEmpty(lastOwnerName))
                {
                    message += " ณ ปัจจุบันผู้เป็นเจ้าของ คือ " + lastOwnerName.ToString().Trim();
                }

                AppUtil.ClientAlertAndRedirect(Page, message, "COC_SCR_002.aspx");
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#2
0
 protected void cbNoteFlag_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         LeadBiz.ChangeNoteFlag(txtTicketID.Text.Trim(), cbNoteFlag.Checked, HttpContext.Current.User.Identity.Name);
     }
     catch (Exception ex)
     {
         string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
         _log.Debug(message);
         AppUtil.ClientAlert(Page, message);
     }
 }
示例#3
0
        protected void btnTransferJob_Click(object sender, EventArgs e)
        {
            try
            {
                var status = StaffBiz.GetStaffStatus(txtUsername.Text.Trim());
                if (status == 1)
                {
                    AppUtil.ClientAlert(Page, "ไม่สามารถโอนงานได้ เนื่องจากพนักงานยังมีสถานะพร้อมรับงานอยู่");
                    return;
                }

                if (cmbTransferee.SelectedItem.Value == "")
                {
                    AppUtil.ClientAlert(Page, "กรุณาเลือกพนักงานที่จะโอนงานให้");
                    return;
                }

                List <string> ticketIdList = new List <string>();
                foreach (GridViewRow row in gvJobOnHand.Rows)
                {
                    if (((CheckBox)row.FindControl("cbTranserJob")).Checked)
                    {
                        ticketIdList.Add(((Label)row.FindControl("lblTicketId")).Text.Trim());
                    }
                }

                if (ticketIdList.Count > 0)
                {
                    LeadBiz.TransferJob(ticketIdList, cmbTransferee.SelectedItem.Value, txtCurrentCocTeam.Text.Trim(), HttpContext.Current.User.Identity.Name);

                    List <LeadDataPopupMonitoring> mainList = DoGetJobOnHandList();
                    BindJobOnHandGridview((COC.Application.Shared.GridviewPageController)pcJobOnHand, mainList.ToArray(), 0);
                    upJobOnHand.Update();

                    AppUtil.ClientAlert(Page, "โอนงานเรียบร้อย");
                }
                else
                {
                    AppUtil.ClientAlert(Page, "กรุณาเลือกงานที่ต้องการโอน");
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
示例#4
0
        protected void btnAddNote_Click(object sender, EventArgs e)
        {
            cbSendEmail.Enabled = LeadBiz.HasOwnerOrDelegate(txtTicketID.Text.Trim());
            if (!cbSendEmail.Enabled)
            {
                lblInfo.Text = "ข้อมูลผู้มุ่งหวังนี้ ยังไม่ถูกจ่ายงานให้ Telesales ดังนั้นการบันทึก Note ไม่สามารถส่ง Email ได้";
            }
            else
            {
                lblInfo.Text = "";
                CheckEmailSubject();
            }

            upPopup.Update();
            mpePopup.Show();
        }
        private bool ValidateData()
        {
            int i = 0;

            //************************************Windows Username********************************************
            if (txtUserName.Text.Trim() == "")
            {
                vtxtUserName.Text      = "กรุณาระบุ Windows Username";
                vtxtUserName.ForeColor = System.Drawing.Color.Red;
                i += 1;
            }
            else
            {
                vtxtUserName.Text = "";
                if (StaffBiz.CheckUsernameExist(txtUserName.Text.Trim(), null))
                {
                    vtxtUserName.Text      = "Windows Username นี้มีอยู่แล้วในระบบแล้ว";
                    vtxtUserName.ForeColor = System.Drawing.Color.Red;
                    i += 1;
                }
                else
                {
                    vtxtUserName.Text = "";
                }
            }

            string desc;

            if (LeadBiz.CheckHeadStaff(txtEmpCode.Text, cmbHeadStaffId.SelectedValue.Trim(), out desc))
            {
                vcmbHeadStaffId.Text = "ไม่สามารถเปลี่ยนหัวหน้างานได้เนื่องจาก " + txtStaffNameTH.Text + "เป็นหัวหน้างาน" + cmbHeadStaffId.Text.Trim();
                i += 1;
            }

            //************************************รหัสพนักงานธนาคาร********************************************
            if (txtEmpCode.Text.Trim() == "")
            {
                vtxtEmpCode.Text = "กรุณาระบุรหัสพนักงานธนาคาร";
                i += 1;
            }
            else
            {
                vtxtEmpCode.Text = "";
                if (StaffBiz.CheckEmpCodeExist(txtEmpCode.Text.Trim(), null))
                {
                    vtxtEmpCode.Text = "รหัสพนักงานธนาคารนี้มีอยู่แล้วในระบบแล้ว";
                    i += 1;
                }
                else
                {
                    vtxtEmpCode.Text = "";
                }
            }

            //************************************รหัสเจ้าหน้าที่การตลาด********************************************
            if (txtMarketingCode.Text.Trim() == "")
            {
                //vtxtMarketingCode.Text = "กรุณาระบุรหัสเจ้าหน้าที่การตลาด";
                //i += 1;
            }
            else
            {
                vtxtMarketingCode.Text = "";
                if (StaffBiz.CheckMarketingCodeExist(txtMarketingCode.Text.Trim(), null))
                {
                    vtxtMarketingCode.Text = "รหัสเจ้าหน้าที่การตลาดนี้มีอยู่แล้วในระบบแล้ว";
                    i += 1;
                }
                else
                {
                    vtxtMarketingCode.Text = "";
                }
            }

            //************************************ชื่อ-นามสกุลพนักงาน********************************************
            if (txtStaffNameTH.Text.Trim() == "")
            {
                vtxtStaffNameTH.Text = "กรุณาระบุชื่อ-นามสกุลพนักงาน";
                i += 1;
            }
            else
            {
                vtxtStaffNameTH.Text = "";
            }

            //************************************E-mail********************************************
            if (txtStaffEmail.Text.Trim() == "")
            {
                vtxtStaffEmail.Text = "กรุณาระบุ E-mail";
                i += 1;
            }
            else
            {
                if (!ValidateEmail())
                {
                    vtxtStaffEmail.Text = "กรุณาระบุ E-mail ให้ถูกต้อง";
                    i += 1;
                }
                else
                {
                    vtxtStaffEmail.Text = "";
                }
            }

            //************************************ตำแหน่ง********************************************
            if (cmbPosition.SelectedItem.Value == "")
            {
                vtxtPositionName.Text = "กรุณาระบุ ตำแหน่ง";
                i += 1;
            }
            else
            {
                vtxtPositionName.Text = "";
            }

            //************************************Role********************************************
            if (cmbStaffType.SelectedItem.Value == "")
            {
                vcmbStaffType.Text = "กรุณาระบุ Role";
                i += 1;
            }
            else
            {
                vcmbStaffType.Text = "";
            }

            //************************************ทีมการตลาด********************************************
            //if (txtTeam.Text.Trim() == "")
            //{
            //    vtxtTeam.Text = "กรุณาระบุ ทีมการตลาด";
            //    i += 1;
            //}
            //else
            //    vtxtTeam.Text = "";

            //************************************สาขา********************************************
            if (cmbBranchCode.SelectedItem.Value == "")
            {
                vcmbBranchCode.Text = "กรุณาระบุ สาขา";
                i += 1;
            }
            else
            {
                vcmbBranchCode.Text = "";
            }

            //************************************ COC Team ********************************************
            if (cmbStaffType.SelectedItem.Value == COCConstant.StaffType.Oper.ToString() || cmbStaffType.SelectedItem.Value == COCConstant.StaffType.SupervisorOper.ToString())
            {
                if (cmbCocTeam.SelectedItem.Value == "")
                {
                    vCocTeam.Text = "กรุณาระบุ COC Team";
                    i            += 1;
                }
                else
                {
                    vCocTeam.Text = "";
                }
            }
            else
            {
                vCocTeam.Text = "";
            }

            if (i > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#6
0
 private List <LeadDataPopupMonitoring> DoGetJobOnHandList()
 {
     return(LeadBiz.GetJobOnHandList(txtCurrentCocTeam.Text.Trim(), txtEmpCode.Text.Trim()));
 }
示例#7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string desc;
                if (LeadBiz.CheckHeadStaff(txtStaffId.Text, cmbHeadStaffId.SelectedValue.Trim(), out desc))
                {
                    AppUtil.ClientAlert(Page, "ไม่สามารถเปลี่ยนหัวหน้างานได้เนื่องจาก " + txtStaffNameTH.Text + "เป็นหัวหน้างาน" + cmbHeadStaffId.Text.Trim());
                    return;
                }
                //เช็ก Lead on hand ในส่วนของ slm
                if (cmbBranchCode.SelectedItem.Value != txtOldBranchCode.Text.Trim())
                {
                    if (LeadBiz.CheckExistLeadOnHand(txtUsername.Text.Trim(), txtEmpCode.Text.Trim()) == false)
                    {
                        SaveData();
                    }
                    else
                    {
                        AppUtil.ClientAlert(Page, "ไม่สามารถเปลี่ยนข้อมูลสาขาได้ เนื่องจากยังมีงานค้างอยู่");
                        return;
                    }
                }
                else if (txtOldIsDeleted.Text.Trim() != txtNewIsDeleted.Text.Trim())
                {
                    if (LeadBiz.CheckExistLeadOnHand(txtUsername.Text.Trim(), txtEmpCode.Text.Trim()) == false)
                    {
                        SaveData();
                    }
                    else
                    {
                        AppUtil.ClientAlert(Page, "ไม่สามารถเปลี่ยนสถานะพนักงานได้ เนื่องจากยังมีงานค้างอยู่");
                        return;
                    }
                }
                else if (cmbCocTeam.SelectedItem.Value != txtCurrentCocTeam.Text.Trim())
                {
                    //if (LeadBiz.CheckLastOwnerOnHand(txtEmpCode.Text.Trim()) == false)
                    //{
                    //    SaveData();
                    //}
                    //else
                    //{
                    //    AppUtil.ClientAlert(Page, "ไม่สามารถเปลี่ยนทีมพนักงานได้ เนื่องจากยังมีงานค้างอยู่");
                    //}

                    List <LeadDataPopupMonitoring> list = DoGetJobOnHandList();
                    if (list.Count > 0)
                    {
                        AppUtil.ClientAlert(Page, "ไม่สามารถเปลี่ยนทีมพนักงานได้ เนื่องจากยังมีงานค้างอยู่");
                        return;
                    }
                    else
                    {
                        string oldCocTeam = txtCurrentCocTeam.Text.Trim();
                        SaveData();

                        _log.Debug("==================== Start Log ====================");
                        _log.Debug("Action: Change COC Team");
                        _log.Debug("ActionBy: " + HttpContext.Current.User.Identity.Name);
                        _log.Debug("DateTime: " + DateTime.Now.ToString("dd-MM-") + DateTime.Now.Year.ToString() + " " + DateTime.Now.ToString("HH:mm:ss"));
                        _log.Debug("Username: "******"TeamFrom: " + oldCocTeam);
                        _log.Debug("TeamTo: " + cmbCocTeam.SelectedItem.Value);
                        _log.Debug("==================== End Log =====================");
                        _log.Debug(" ");
                    }
                }
                else
                {
                    SaveData();
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }