コード例 #1
0
 public string BroadCastSMS(Cog.MLIAD.BusinessLogic.Associate.SMS newSMS)
 {
     try
     {
         MLIADService.SetNoCache();
         string retval = repository.SendSMS(newSMS);
         return(retval);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public string BroadCastSMS(Cog.MLIAD.BusinessLogic.Associate.SMS newSMS)
        {
            string retVal = "Sent failed..";

            #region previous Code
            //string status;
            //newSMS.userID = "8961540630";
            //newSMS.password = "******";

            //CookieContainer cookie = SMSClientLib.Login.Connect(newSMS.userID, newSMS.password, out status);
            //    if (status.ToLower() == "connected")
            //    {
            //        string[] smsTextList = CreateSMSText(newSMS.smsBody, 140);
            //        string[] siteParameters = SMSClientLib.Login.GetSiteParameters(cookie);
            //        string messgeSentResult = "";

            //        for (int i = 0; i < smsTextList.Length; i++)
            //        {
            //            messgeSentResult = SMSClientLib.SendSMS.Send_Processing(newSMS.toList, smsTextList[i], cookie, siteParameters);
            //        }

            //        retVal = "Sent Successfully..";
            //    }
            //WebRequest request;
            //WebResponse response;
            //StreamReader reader;
            //string url = "";
            //string urlText = "";
            //string[] mobileNumber = newSMS.toList.Split(';');

            //for (int i = 0; i < mobileNumber.Length; i++)
            //{
            //    // sample url: "http://203.92.40.186:8181/Sun3/Send_SMS2x?user=cogniz&password=cogniz123&PhoneNumber=91<MobileNumber>&sender=COGNIZ&text=<SMS text>"
            //    url = "http://203.92.40.186:8181/Sun3/Send_SMS2x?user=cogniz&password=cogniz123&PhoneNumber=" + mobileNumber[i] + "&sender=COGNIZ&text=" + newSMS.smsBody;
            //    request = HttpWebRequest.Create(url);
            //    response = request.GetResponse();
            //    reader = new StreamReader(response.GetResponseStream());
            //    urlText = reader.ReadToEnd();
            //    retVal = (urlText == "Message has been accepted.") ? "Sent Successfully.." : "Sent failed..";
            //}
            #endregion
            string[] mobileNumber = newSMS.toList.Split(';');
            bool     valSMS       = false;
            for (int i = 0; i < mobileNumber.Length; i++)
            {
                valSMS = SendSMS(newSMS.smsBody, Convert.ToString(mobileNumber[i]));
                retVal = (valSMS == true) ? "Sent Successfully.." : "Sent failed..";
            }
            return(retVal);
        }
コード例 #3
0
        public string AddAssociate(Cog.MLIAD.BusinessLogic.Associate.Associate associate)
        {
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                try
                {
                    int retasct = 0;
                    retasct = asscon.Add_Associate(associate.AssociateID, associate.FirstName, associate.LastName, associate.Mobile, associate.email, associate.DirectReportID, associate.IsApproved, associate.ProjectID, associate.LocationID, associate.DesignationID, associate.DOJ, associate.DOB, associate.IsActive, associate.UserID, associate.Password, associate.GroupID);
                    if (!(retasct == 0))
                    {
                        BusinessLogic.Associate.Associate approver = (from a in asscon.get_AdminByGroup(associate.GroupID)
                                                                      select new Cog.MLIAD.BusinessLogic.Associate.Associate()
                                                                      {
                                                                          AssociateID = a.AssociateID,
                                                                          FirstName = (a.FirstName == null) ? "" : a.FirstName,
                                                                          LastName = (a.LastName == null) ? "" : a.LastName,
                                                                          Mobile = (a.Mobile == null) ? "" : a.Mobile,
                                                                          email = (a.email == null) ? "" : a.email,
                                                                          UserID = (a.UserId == null) ? "" : a.UserId
                                                                      }).SingleOrDefault<Cog.MLIAD.BusinessLogic.Associate.Associate>();

                        string sendSubject = "Pending Request";
                        string mailbody = "<html><body>Dear " + approver.FirstName + ",<br /> You have pending request to approve for " + associate.FirstName + " " + associate.LastName + ".<br / >Please login to www.AssociateConnect.com to approve the request.<br / ><br />Regards,<br />AssociateConnect Admin Team<body><html>";
                        SendEmail(sendSubject, mailbody, associate.email, approver.email,true);
                        sendSubject = "Request Summited";
                        mailbody = "<html><body>Dear " + associate.FirstName + ",<br /> your request is successfully submitted to" + approver.FirstName + " " + approver.LastName + " for approval.<br / >You will get confirmation mail once your request gets appreved.<br / ><br />Regards,<br />AssociateConnect Admin Team<body><html>";
                        SendEmail(sendSubject, mailbody, approver.email, associate.email,true);

                        BusinessLogic.Associate.SMS sms = new SMS();
                        sms.smsBody = "You have pending request to approve for " + associate.FirstName + " " + associate.LastName + ".";
                        sms.toList = approver.Mobile;
                        SendSMS(sms);
                        sms.smsBody = "your request is successfully submitted to" + approver.FirstName + " " + approver.LastName + " for approval.";
                        sms.toList = associate.Mobile;
                        SendSMS(sms);

                        return "success";
                    }
                    else
                        return "failure";
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
コード例 #4
0
        public int ApproveRequest(string AssociateID, string RoleID, string[] GroupIDs, string ApproverUserName)
        {
            int retval = 0;
            BusinessLogic.Associate.Associate approver = new BusinessLogic.Associate.Associate();
            BusinessLogic.Associate.Associate requester = new BusinessLogic.Associate.Associate();
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                int id = (AssociateID == "") ? 0 : Convert.ToInt32(AssociateID);
                int rid = (RoleID == "") ? 0 : Convert.ToInt32(RoleID);
                foreach (string GroupID in GroupIDs)
                {
                    int gid = (GroupID == "") ? 0 : Convert.ToInt32(GroupID);
                    retval = asscon.ApproveMember(id, rid, gid);
                }
                requester = GetAssociateByID(id.ToString());
                approver = GetAssociatesByUserID(ApproverUserName);
                approver = GetAssociateByID(approver.AssociateID.ToString());
            }
            string sendSubject = "Request Approved";
            string mailbody = "<html><body>Dear " + requester.FirstName + ",<br /> Your request has been successfuly approved by " + approver.FirstName + " " + approver.LastName + ".<br />You can logon to www.AssociateConnect.com<br /><br />Regards,<br />AssociateConnect Admin Team<body><html>";
            SendEmail(sendSubject, mailbody, approver.email, requester.email, true);

            sendSubject = "Request Approved";
            mailbody = "<html><body>Dear " + approver.FirstName + ",<br /> You have successfully approved the request of " + requester.FirstName + " " + requester.LastName + ".<br / ><br />Regards,<br />AssociateConnect Admin Team<body><html>";
            SendEmail(sendSubject, mailbody, requester.email, approver.email, true);

            BusinessLogic.Associate.SMS sms = new SMS();
            sms.smsBody = "Your request is approved by " + approver.FirstName + " " + approver.LastName + ". Now you can login to www.AssociateConnect.com";
            sms.toList = requester.Mobile;
            SendSMS(sms);

            sms.smsBody = "You have successfully approved the request of " + requester.FirstName + " " + requester.LastName + ". You can logon to www.AssociateConnect.com.";
            sms.toList = approver.Mobile;
            SendSMS(sms);

            return retval;
        }
コード例 #5
0
        public int RejectRequest(string AssociateID, string Group, string Role, string ApproverUserName)
        {
            int retval = 0;
            int id = (AssociateID == "") ? 0 : Convert.ToInt32(AssociateID);
            BusinessLogic.Associate.Associate approver = new BusinessLogic.Associate.Associate();
            BusinessLogic.Associate.Associate requester = new BusinessLogic.Associate.Associate();
            using (AssociateConnDataContext asscon = new AssociateConnDataContext())
            {
                requester = GetAssociateByID(id.ToString());
                approver = GetAssociatesByUserID(ApproverUserName);
                approver = GetAssociateByID(approver.AssociateID.ToString());
                retval = asscon.RejectMember(id);
            }
            string sendSubject = "Request Rejected";
            string mailbody = "<html><body>Dear " + requester.FirstName + ",<br /> Your request has been rejected by " + approver.FirstName + " " + approver.LastName + ".<br /><br />Regards,<br />AssociateConnect Admin Team<body><html>";
            SendEmail(sendSubject, mailbody, approver.email, requester.email, true);

            sendSubject = "Request Approved";
            mailbody = "<html><body>Dear " + approver.FirstName + ",<br /> You have successfully rejected the request of " + requester.FirstName + " " + requester.LastName + ".<br / ><br />Regards,<br />AssociateConnect Admin Team<body><html>";
            SendEmail(sendSubject, mailbody, requester.email, approver.email, true);

            BusinessLogic.Associate.SMS sms = new SMS();
            sms.smsBody = "Your request is rejected by " + approver.FirstName + " " + approver.LastName + ".";
            sms.toList = requester.Mobile;
            SendSMS(sms);

            sms.smsBody = "You have successfully rejected the request of " + requester.FirstName + " " + requester.LastName + ".";
            sms.toList = approver.Mobile;
            SendSMS(sms);

            return retval;
        }