Ejemplo n.º 1
0
        }     //End public CPARChat_DetailVM getData(string id = null)

        public CPARChat_DetailVM getData_details(string id = null)
        {
            CPARChat_DetailVM oReturn = new CPARChat_DetailVM();

            oReturn.CPARCHAT = getDatalist_details(id);
            return(oReturn);
        } //End public CPARChat_DetailVM getData(string id = null)
Ejemplo n.º 2
0
        }                                                 //End public void Create

        public void Update(CPARChat_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPARChat oModel = db.CPARChats.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <CPARChat_DetailVM, CPARChat>();
                    oModel = Mapper.Map <CPARChat_DetailVM, CPARChat>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
Ejemplo n.º 3
0
 //Constructor
 public CPARChat_Validation(CPARChat_DetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public CPARChat_Validation()
Ejemplo n.º 4
0
        }                         //End public CPARChatCRUD()

        public void Create(CPARChat_DetailVM poViewModel)
        {
            string vsMsgErr         = "";
            string sSENDER_ROLERUID = hlpConfig.SessionInfo.getAppRoleRUID();

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPARChat oModel = new CPARChat();
                    //Map Form Data
                    Mapper.CreateMap <CPARChat_DetailVM, CPARChat>();
                    oModel = Mapper.Map <CPARChat_DetailVM, CPARChat>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Set field
                    oModel.CPAR_RUID     = poViewModel.CPAR_RUID;
                    oModel.USR_RUID      = oModel.ADTRL_USR;
                    oModel.CHAT_DESC_FMT = oModel.CHAT_DESC_PLAIN;
                    //Add model to save
                    db.CPARChats.Add(oModel);

                    CPARChatnotifyCRUD oCRUD_notify = new CPARChatnotifyCRUD();
                    //Send Notification to AUDITEE
                    if (sSENDER_ROLERUID == valFLAG.FLAG_ROLE_CPAR_ADMIN)
                    {
                        CPARDS oDS_CPAR  = new CPARDS();
                        var    oQRY_cpar = oDS_CPAR.getData(oModel.CPAR_RUID);
                        CPARChatnotify_DetailVM oVM_notify = new CPARChatnotify_DetailVM();
                        oVM_notify.CPARCHAT_RUID = oModel.RUID;
                        oVM_notify.USR_RUID      = oQRY_cpar.AUDITEE_USRRUID; //oQRY_cpar.AUDITEE_RUID;
                        oCRUD_notify.Create_prepare(oVM_notify);
                        CPARChatnotify oModel_notify = oCRUD_notify.oModel;
                        //Add model to save
                        db.CPARChatnotifys.Add(oModel_notify);
                    } //End if (sSENDER_ROLERUID != valFLAG.FLAG_ROLE_CPAR_ADMIN)

                    //Send Notification to CPAR_ADMIN
                    if (sSENDER_ROLERUID != valFLAG.FLAG_ROLE_CPAR_ADMIN)
                    {
                        UserDS oDS_user  = new UserDS();
                        var    oQRY_user = oDS_user.getDatalist(valFLAG.FLAG_ROLE_CPAR_ADMIN);
                        foreach (var item in oQRY_user)
                        {
                            CPARChatnotify_DetailVM oVM_notifyX = new CPARChatnotify_DetailVM();
                            oVM_notifyX.CPARCHAT_RUID = oModel.RUID;
                            oVM_notifyX.USR_RUID      = item.RUID;
                            oCRUD_notify.Create_prepare(oVM_notifyX);
                            CPARChatnotify oModel_notifyX = oCRUD_notify.oModel;
                            //Add model to save
                            db.CPARChatnotifys.Add(oModel_notifyX);
                        } //End foreach (var item in oQRY_user)
                    }     //End if (sSENDER_ROLERUID == valFLAG.FLAG_ROLE_CPAR_ADMIN)


                    //Process CRUD
                    db.SaveChanges();
                    this.RUID = oModel.RUID;
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create