public bool SaveCommunication(CommunicationModel obj)
 {
     try
     {
         communication oComm = new communication();
         oComm.SentTo                = obj.SentTo;
         oComm.WhenToSend            = obj.WhenToSend;
         oComm.SentTime              = DateTime.Now;
         oComm.Subject               = obj.Subject;
         oComm.AlertTypeID           = 1;
         oComm.CommunicationStatusID = 3;
         oComm.Contents              = obj.Contents;
         oComm.CreatedDate           = DateTime.Now;
         oDB.Communication.Add(oComm);
         oDB.SaveChanges();
         oDB.Dispose();
         oDB = null;
         return(true);
     }
     catch (Exception ex)
     {
         throw;
     }
     return(false);
 }
Ejemplo n.º 2
0
        public ActionResult sendemail(CommunicationModel emails)
        {
            Nahda_AttendanceEntities db    = new Nahda_AttendanceEntities();
            CommunicationGroupMaster mster = new CommunicationGroupMaster();

            mster.Title     = emails.Title;
            mster.Remarks   = emails.Remarks;
            mster.CreatedBy = "Naveed";
            mster.CreatedOn = DateTime.Now;
            mster.School    = Convert.ToInt32(emails.SchlsId);
            List <CommunicationGroupDetail> list = new List <CommunicationGroupDetail>();

            foreach (var i in emails.selecteditems)
            {
                string[] split = i.Split('/');
                CommunicationGroupDetail obj = new CommunicationGroupDetail();
                obj.CreatedBy = "Naveed";
                obj.CreatedOn = DateTime.Now;
                obj.Email     = split[1];
                obj.StaffId   = Convert.ToInt32(split[0]);
                list.Add(obj);
            }
            mster.CommunicationGroupDetails = list;
            db.CommunicationGroupMasters.Add(mster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult emails(CommunicationModel idslist)
        {
            List <sendemail> list    = new List <sendemail>();
            List <int>       intlist = JsonConvert.DeserializeObject <List <int> >(idslist.intlist);

            list.Add(new sendemail {
                Id = 1, Name = "Naveed", Email = "*****@*****.**"
            });
            list.Add(new sendemail {
                Id = 2, Name = "Khalid", Email = "*****@*****.**"
            });
            list.Add(new sendemail {
                Id = 3, Name = "Fazal", Email = null
            });
            var list2 = (from m in list join q in intlist on m.Id equals q select m).ToList();
            //CommunicationModel mdl=new CommunicationModel(
            var selectlist = list2.Select(x => new SelectListItem {
                Text = (x.Email == null)?x.Name:x.Name + "(" + x.Email + ")", Value = (x.Email == null) ?x.Id.ToString() + "":x.Id + "/" + x.Email, Selected = (x.Email == null)?true:false
            }).ToList();

            ViewBag.count = list2.Count();
            CommunicationModel obj = new CommunicationModel();

            obj.sendemailList         = list2;
            obj.HREmployeeMstslctList = selectlist;
            //obj.selecteditems = (from m in intlist join q in list on m equals q.Id where q.Email==null select m).ToList();
            return(PartialView(obj));
        }
Ejemplo n.º 4
0
        public ResultModel ResendCode(subscriberModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try {
                Utitilty oUtility = new Utitilty();
                obj.VerificationCode = oUtility.GetVerificationCode(3);

                var oSubscriberDetail = dbSet.Where(m => m.EmailAddress == obj.EmailAddress && m.GurudwaraCode == obj.GurudwaraCode).FirstOrDefault();
                if (oSubscriberDetail != null)
                {
                    oSubscriberDetail.VerificationCode = obj.VerificationCode;
                    oSubscriberDetail.IsVerified       = false;
                    oDB.SaveChanges();
                }

                #region Send Email Communication

                CommunicationModel oModel = new CommunicationModel();
                oModel.AlertTypeID = 1;
                oModel.Contents    = "Your Verification Code is " + obj.VerificationCode;
                oModel.Subject     = "Verication Code";
                oModel.SentTo      = obj.EmailAddress;
                oModel.WhenToSend  = DateTime.Now;
                oModel.CreatedDate = DateTime.Now;
                _svr.SendCommunication(oModel);
                #endregion
            } catch (Exception ex) {
            }
            return(oOutput);
        }
Ejemplo n.º 5
0
        public IActionResult UpdatePatient([FromBody] CommunicationModel patient)
        {
            Patient p;

            try
            {
                if (patient == null || !ModelState.IsValid)
                {
                    return(BadRequest(CommunicationErrorCode.MissingPatientInformation.ToString()));
                }

                p = patientRepo.Find(patient.patientID);

                if (p == null)
                {
                    return(BadRequest(CommunicationErrorCode.CouldNotFindPatient.ToString()));
                }

                p.SetStage(patient.newStage);
            }
            catch (Exception)
            {
                return(BadRequest(CommunicationErrorCode.CouldNotUpdatePatient.ToString()));
            }

            return(Ok(p));
        }
Ejemplo n.º 6
0
        public async Task <CommunicationModel <UserInfo> > UserLogin(string code, string pwd)
        {
            CommunicationModel <UserInfo> communicationModel = new CommunicationModel <UserInfo>();
            var users = await this._userRepository.QueryAsync(w => w.UserCode == code);

            if (!users.Any())
            {
                communicationModel.Success = false;
                communicationModel.Message = "账号不存在";
            }
            else
            {
                var user = users.FirstOrDefault(w => w.UserCode == code && w.PassWord == MD5($"{pwd}{w.ID}"));
                if (user == null)
                {
                    communicationModel.Message = "密码错误";;
                    communicationModel.Success = false;
                }
                else
                {
                    communicationModel.Success = true;
                    communicationModel.Data    = user;
                }
            }

            return(communicationModel);
        }
        /// <summary>
        /// satff performance
        /// </summary>
        /// <createdby>Rohit k</createdby>
        ///  <createdDate>12 nov 2013</createdDate>
        /// <returns>view StaffPerformance with model data</returns>
        public ActionResult StaffPerformance()
        {
            logMessage = new StringBuilder();
            try
            {
                logMessage.AppendLine(string.Format(CultureInfo.InvariantCulture, DecisionPointR.logmessagestart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                if (string.IsNullOrEmpty(Convert.ToString(Session["UserId"], CultureInfo.InvariantCulture)))
                {
                    return(RedirectToAction("Login", "Login"));
                }
                else
                {
                    userId    = Convert.ToInt32(Session["UserId"], CultureInfo.InvariantCulture);
                    companyId = Convert.ToString(Session["CompanyId"], CultureInfo.InvariantCulture);
                    objDecisionPointEngine = new DecisionPointEngine();
                    CommunicationModel communicationModel = new CommunicationModel();
                    communicationModel.staffPerformanceLst = objDecisionPointEngine.GetStaffPerformanceList(userId, companyId).ToList();
                    communicationModel.pagesize            = communicationModel.staffPerformanceLst.Count();
                    communicationModel.rowperpage          = Convert.ToInt32(ConfigurationManager.AppSettings["rowperpage"], CultureInfo.InvariantCulture);

                    return(View("StaffPerformance", communicationModel));
                }
            }
            catch (Exception ex)
            {
                log.ErrorFormat(DecisionPointR.logmessageerror, ex.ToString(), typeof(LoginController).Name, MethodBase.GetCurrentMethod().Name);
                throw;
            }
            finally
            {
                logMessage.AppendLine(string.Format(CultureInfo.InvariantCulture, DecisionPointR.logmessagend, MethodBase.GetCurrentMethod().Name));
                log.Info(logMessage.ToString());
            }
        }
Ejemplo n.º 8
0
        public ActionResult loaddpt(int id)
        {
            var model = new CommunicationModel();

            model.SelectListItemDepartment = db.hr_department.Where(x => x.SchoolId == id).Select(x => new SelectListItem()
            {
                Text = x.dept_NameEn, Value = id.ToString()
            }).ToList();
            return(PartialView(model));
        }
        public override Task <CommunicationModel> GetChannelById(CommunicationChannelRequest request, ServerCallContext context)
        {
            CommunicationModel output = new CommunicationModel();

            output = mockModel.Find(x => x.ChannelId == request.ChannelId);

            context.Status = new Status(StatusCode.OK, $"ok");

            return(Task.FromResult(output));
        }
Ejemplo n.º 10
0
        //public ActionResult loaddepartments()
        //{

        //}(
        public ActionResult Detailview(CommunicationModel model)
        {
            CommunicationModel modl = new CommunicationModel();

            modl.HREmployeeMstslctList = db.HREmployeeMsts.Where(x => x.SchoolId == model.SchlsId).Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(), Text = x.hr_name
            }).ToList();
            return(PartialView(modl));
        }
 public Platform(Enviroment enviroment, ControlPolicy.ControlPolicyAbstract controller, CommunicationModel commModel)
 {
     Pose = new Pose();
     Map  = new MapObject(enviroment.Map.Rows, enviroment.Map.Columns);
     enviroment.Platforms.Add(this);
     this.enviroment         = enviroment;
     FieldOfViewRadius       = 2;
     this.ControlPolicy      = controller;
     this.CommunicationModel = commModel;
     IDs++;
     this.ID    = IDs;
     this.Color = Color.Blue;
 }
Ejemplo n.º 12
0
        async void OnGenericButtonClicked(object sender, EventArgs e)
        {
            CommunicationModel comm = new CommunicationModel();

            comm.patientID = patient.id;
            comm.newStage  = (PatientStage)(patient.stage + 1);

            Console.WriteLine($"Patient ID: {patient.id}\nNext Stage: {comm.newStage}\nBuffer");

            Button.IsEnabled = false;

            await App.patientManager.SendCommunicationAsync(comm);
        }
Ejemplo n.º 13
0
        //ctor
        public SimulatorViewModel(INavigationService navigationService, ILineService lineService, ISimulatorService simulatorService)
        {
            _simulatorService  = simulatorService;
            _lineService       = lineService;
            _navigationService = navigationService;
            Communication      = new CommunicationModel();
            Client             = new ClientModel();
            Line            = new LineModel();
            DestinationLine = new LineModel();

            InitializeObservableCollections();
            InitializeCommands();
        }
Ejemplo n.º 14
0
        //public static SMSModel ToModel(this SMSDto sms)
        //{
        //    return new SMSModel()
        //    {
        //        DestinationNumber = sms.DestinationNumber,
        //        ExternalPrice = sms.ExternalPrice,
        //        LineId = sms.LineId,
        //        SMSId = sms.SMSId,
        //        //Line = sms.Line.ToModel(),
        //        Time = sms.Time
        //    };
        //}

        //public static SMSDto ToDto(this SMSModel sms)
        //{
        //    return new SMSDto()
        //    {
        //        DestinationNumber = sms.DestinationNumber,
        //        ExternalPrice = sms.ExternalPrice,
        //        LineId = sms.LineId,
        //        SMSId = sms.SMSId,
        //        //Line = sms.Line.ToDto(),
        //        Time = sms.Time
        //    };
        //}

        public static SMSDto ToSms(CommunicationModel model)
        {
            if (model == null)
            {
                return(null);
            }
            return(new SMSDto()
            {
                DestinationNumber = model.DestinationNumber,
                ExternalPrice = model.ExternalPrice,
                LineId = model.LineId,
                Time = model.Time
            });
        }
Ejemplo n.º 15
0
 public static CallsDto ToCall(CommunicationModel model, double duration)
 {
     if (model == null)
     {
         return(null);
     }
     return(new CallsDto()
     {
         DestinationNumber = model.DestinationNumber,
         ExternalPrice = model.ExternalPrice,
         LineId = model.LineId,
         Time = model.Time,
         Duration = duration
     });
 }
Ejemplo n.º 16
0
        public ActionResult loadsub(int id)
        {
            CommunicationModel model = new CommunicationModel();

            model.SelectListItemSubjects = (from emp in db.HREmployeeMsts
                                            join subGrp in db.Exam_subjectGroup on emp.AccountId equals subGrp.StaffId
                                            join examSub in db.Exam_Subjects on subGrp.SubjectId equals examSub.Id
                                            where emp.hr_DeptId == id
                                            select examSub
                                            ).Distinct().Select(x => new SelectListItem()
            {
                Text = x.Title, Value = x.Id.ToString()
            }).ToList();
            //subject group
            return(PartialView(model));
        }
        public ResultModel SendCommunication(CommunicationModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                // SendEmail(obj.SentTo,obj.Subject, obj.Contents);
                SaveCommunication(obj);
            }
            catch (Exception ex)
            {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
Ejemplo n.º 18
0
        public ActionResult Index()
        {
            CommunicationModel lists = new CommunicationModel();

            lists.SelectListItemSChool = db.Schools.Select(x => new SelectListItem()
            {
                Text = x.SchoolNameEn, Value = x.Id.ToString()
            }).ToList();
            lists.SelectListItemDepartment = db.hr_department.Select(x => new SelectListItem()
            {
                Text = x.dept_NameEn, Value = x.Id.ToString()
            }).ToList();
            lists.SelectListItemSubjects = db.Exam_Subjects.Select(x => new SelectListItem()
            {
                Text = x.Title, Value = x.Id.ToString()
            }).ToList();
            return(View(lists));
        }
Ejemplo n.º 19
0
 public async Task CreateCommunication(CommunicationModel communication, bool isSms, double duration)
 {
     communication.Time   = DateTime.Now;
     communication.LineId = communication.Line.LineId;
     if (isSms)
     {
         SMSDto sms = ModelExtensions.ToSms(communication);
         if (sms != null)
         {
             await invoice.AddSMSAsync(sms);
         }
     }
     else
     {
         CallsDto call = ModelExtensions.ToCall(communication, duration);
         if (call != null)
         {
             await invoice.AddCallAsync(call);
         }
     }
 }
Ejemplo n.º 20
0
        public async Task CommunicationAsync(CommunicationModel communication)
        {
            Uri uri = new Uri($"{restURL}api/communication");

            try
            {
                string        json    = JsonConvert.SerializeObject(communication);
                StringContent content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage msg = await client.PutAsync(uri, content);

                if (msg.IsSuccessStatusCode)
                {
                    Debug.WriteLine(@"\tUser logged in successfully.");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"\tERROR {ex.Message}");
            }

            return;
        }
Ejemplo n.º 21
0
        public ResultModel Register(subscriberModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try {
                Utitilty oUtility = new Utitilty();
                obj.VerificationCode = oUtility.GetVerificationCode(3);
                var oSubscriber = dbSet.Where(m => m.EmailAddress == obj.EmailAddress && m.GurudwaraCode == obj.GurudwaraCode).FirstOrDefault();

                subscriber osubscriber = Mapper.Map <subscriber> (obj);
                if (oSubscriber == null)
                {
                    dbSet.Add(osubscriber);
                    oDB.SaveChanges();
                }

                #region Send Email Communication

                CommunicationModel oModel = new CommunicationModel();
                oModel.AlertTypeID = 1;
                oModel.Contents    = "Your Verification Code is " + obj.VerificationCode;
                oModel.Subject     = "Verication Code";
                oModel.SentTo      = obj.EmailAddress;
                oModel.WhenToSend  = DateTime.Now;
                oModel.CreatedDate = DateTime.Now;
                _svr.SendCommunication(oModel);
                #endregion

                oOutput.Data = Mapper.Map <subscriberModel> (osubscriber);
            } catch (Exception ex) {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
Ejemplo n.º 22
0
 public Task SendCommunicationAsync(CommunicationModel communication)
 {
     return(rest.CommunicationAsync(communication));
 }
        private void setAllPlatformsAndSave(ControlPolicy.ControlPolicyAbstract policy, CommunicationModel comm, String path, String fileWithoutExtension)
        {
            String cpPrefix = "";

            foreach (Platform plt in enviroment.Platforms)
            {
                if (policy is ClosestFronterierControlPolicy)
                {
                    plt.ControlPolicy = new ClosestFronterierControlPolicy();
                    cpPrefix          = "cf";
                }

                if (policy is MaxInformationGainControlPolicy)
                {
                    plt.ControlPolicy = new MaxInformationGainControlPolicy();
                    cpPrefix          = "mi";
                }

                if (policy is BidingControlPolicy)
                {
                    plt.ControlPolicy = new BidingControlPolicy();
                    cpPrefix          = "bf";
                }
            }

            String commPrefix = "";

            foreach (Platform plt in enviroment.Platforms)
            {
                if (comm is NearbyCommunicationModel)
                {
                    plt.CommunicationModel = new NearbyCommunicationModel();
                    commPrefix             = "nc";
                }

                if (comm is GlobalCommunicationModel)
                {
                    plt.CommunicationModel = new GlobalCommunicationModel();
                    commPrefix             = "gc";
                }
            }


            String          newEnviromentPath = path + "//" + fileWithoutExtension + "_" + commPrefix + "_" + cpPrefix + ".bin";
            Stream          stream            = new FileStream(newEnviromentPath, FileMode.Create, FileAccess.Write, FileShare.None);
            BinaryFormatter binaryFormatter   = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            binaryFormatter.Serialize(stream, this.enviroment);
            stream.Close();
        }
Ejemplo n.º 24
0
        public void SendData(CommunicationModel data)
        {
            var sendData = JsonConvert.SerializeObject(data);

            SendData(sendData);
        }