Пример #1
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        reqid = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+"));
        ds_analytics.requestsDataTable req_dt = requests.getRequestbyReqid(reqid);
        if (req_dt.Count > 0)
        {
            req_row = req_dt[0];
        }
        else
        {
            Response.Write("<script>alert('Error in request.');</script>");
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        reqid  = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+"));
        labid  = Convert.ToInt64(e64.Decrypt(Request.QueryString.Get("labid").Replace(" ", "+")));
        userid = Session["userid"].ToString();

        load_gsk_address();
        load_lab();
        load_sender();

        //2 - Auto Print Pop-up
        Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
    }
Пример #3
0
        public ActionResult LoadAttachmentList(string docid)
        {
            long documentId           = default(long);
            List <AttachmentFile> lst = new List <AttachmentFile>();

            try
            {
                long.TryParse(Encryption64.DecryptQueryString(docid), out documentId);
                lst = DBOperations <AttachmentFile> .GetAllOrByRange(new AttachmentFile()
                {
                    DocID = documentId, Opmode = default(int)
                }, Constant.usp_Attachment);
            }
            catch (Exception) { }
            return(PartialView("_AttachmentList", lst));
        }
Пример #4
0
    protected void Page_Init(object sender, EventArgs e)
    {
        mode = Request.QueryString.Get("mode");
        user = Request.QueryString.Get("user");

        Encryption64 e64 = new Encryption64();

        process_reqid = e64.Decrypt(Request.QueryString.Get("process_reqid").Replace(" ", "+"));
        ds_analytics.requestsDataTable req_dt = requests.getRequestbyReqid(process_reqid);
        process_req_row = req_dt[0];

        userid           = Session["userid"].ToString();
        no_samples       = Convert.ToInt32(e64.Decrypt(Request.QueryString.Get("nosample").Replace(" ", "+")));
        no_tests         = Convert.ToInt32(e64.Decrypt(Request.QueryString.Get("notest").Replace(" ", "+")));
        no_samples_intab = int.Parse(System.Configuration.ConfigurationManager.AppSettings["no_samples_intab"].ToString());

        if (!IsPostBack)
        {
            lbl_status.Text = other.getStatustext(1);

            rtype = e64.Decrypt(Request.QueryString.Get("rtype").Replace(" ", "+"));

            set_page_ddl();
            bind_page_ddl();

            set_page_samples();

            bind_page_tests();

            build_dt_test_sample();
            build_gv_test_sample();
            bind_gv_test_sample();

            Page.Validate();
        }
        else
        {
            rtype = Request.Form[ddl_typerequest.UniqueID];

            set_page_samples();

            build_gv_test_sample();

            Page.Validate();
        }
    }
        public override AdministradorDTO Salvar(AdministradorDTO entradaDTO, Guid id = default)
        {
            var senhaAleatoria = Usuario.SenhaAleatoria();

            if (entradaDTO.Id == Guid.Empty)
            {
                entradaDTO.Senha = Encryption64.Encrypt(senhaAleatoria);
            }

            var dto = base.Salvar(entradaDTO, id);

            if (id == default && dto?.Id != Guid.Empty)
            {
                _emailSenhaNovoUsuarioServicoAplicacao.Enviar(dto.Email, dto.Nome, senhaAleatoria);
            }

            return(dto);
        }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        reqid = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+"));

        ds_analytics.requestsDataTable req_dt = requests.getRequestbyReqid(reqid);
        if (req_dt.Count > 0)
        {
            req_row = req_dt[0];
            prj_row = projects.getProjectByPrjid(req_row.projectid)[0];

            this.Title = prj_row.projectname + "_" + req_row.reqdate.ToString("yyyy_MM") + "_" + reqid + ".pdf";

            if (!string.IsNullOrEmpty(Request.QueryString.Get("action")) && (Request.QueryString.Get("action").ToLower() == "pdf"))
            {
                strPdfFileName = this.Title;
                isPDFrequest   = true;
            }
        }
        else
        {
            Response.Write("<script>alert('No request found.');</script>");
        }

        if (!IsPostBack)
        {
            bind_req_header();
            bind_req_samples();
            if (req_row.statusid > 5)
            {
                pnl_LabResults.Visible = true;
                bind_lab_results();
            }
            bind_req_tests();
            bind_test_samples();
        }

        if (!isPDFrequest)
        {
            // Auto Pop-up for print request
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        reqid         = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+"));
        labid         = Convert.ToInt64(e64.Decrypt(Request.QueryString.Get("labid").Replace(" ", "+")));
        req_reference = projects.getProjectByPrjid(requests.getRequestbyReqid(reqid)[0].projectid)[0].projectname.Substring(0, 3) + reqid;  //First three letters of project name + reqid

        if (!IsPostBack)
        {
            DataTable dt_SampleTestLab = labresult.getSampleTestLabByJoining(reqid);
            //1 - Filter for only selected lab
            DataRow[] d_rows = dt_SampleTestLab.Select("labid = '" + labid.ToString() + "'");
            DataTable dt_SampleTestLab_filtered = dt_SampleTestLab.Clone();
            foreach (DataRow dr in d_rows)
            {
                dt_SampleTestLab_filtered.ImportRow(dr);
            }

            //2 - Finding Unique Samples
            DataView view = new DataView(dt_SampleTestLab_filtered);
            dt_SampleTestLab_filtered = view.ToTable(true, "sampleid", "sample_quantity");

            //3 - Bind Repeater
            Repeater1.DataSource = dt_SampleTestLab_filtered;
            Repeater1.DataBind();

            //4 - Bind Lab Address etc.
            ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0];
            lbl_name1.Text    = lab_row.contact_person;
            lbl_name2.Text    = lab_row.key_acc_person;
            lbl_lab_name.Text = lab_row.labname;
            lbl_lab_add.Text  = lab_row.address;
            lbl_lab_city.Text = lab_row.city;
            lbl_email1.Text   = lab_row.email1;
            lbl_mbl1.Text     = lab_row.mbl1;
            lbl_phn1.Text     = lab_row.phn1;

            //5 - Auto Print Pop-up
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
        }
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        reqid = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+"));

        if (!IsPostBack)
        {
            //Fetching sample_test_lab data
            DataTable dt_SampleTestLab = labresult.getSampleTestLabByJoining(reqid);
            DataView  dv             = dt_SampleTestLab.DefaultView;
            string[]  columnNames    = { "labid", "labname", "email1", "city", "contact_person", "mbl1" };
            DataTable dt_unique_labs = dv.ToTable(true, columnNames);
            Repeater1.DataSource = dt_unique_labs;
            Repeater1.DataBind();
        }
        else
        {
        }
    }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        if (!IsPostBack)
        {
            ((MenuItem)((Menu)Master.FindControl("Menu1")).FindItem("Projects")).Selected = true;
            ViewState["SortOrder"] = " ASC";

            long prjid = Convert.ToInt64(e64.Decrypt(Request.QueryString.Get("prj").Replace(" ", "+")));

            //Header Bound
            ds_analytics.projectsRow prj_row = projects.getProjectByPrjid(prjid)[0];
            lbl_name.Text     = prj_row.projectname;
            lbl_type.Text     = prj_row.projecttype;
            lbl_category.Text = prj_row.projectcategory;
            lbl_brand.Text    = prj_row.projectbrand;
            if (!prj_row.IscreatedateNull())
            {
                lbl_start.Text = prj_row.createdate.ToString("dd/MM/yyyy");
            }
            if (!prj_row.IscompletiondateNull())
            {
                lbl_end.Text = prj_row.completiondate.ToString("dd/MM/yyyy");
            }
            if (!prj_row.IsbudgetNull())
            {
                lbl_budget.Text = Convert.ToString(prj_row.budget);
            }
            cb_active.Checked = prj_row.isactive;

            //GridView
            ds_analytics.requestsDataTable req_dt = requests.getAllRequestsByProjID(prjid);
            gv_requests.DataSource = req_dt;
            gv_requests.DataBind();
            ViewState["dtStored"] = req_dt;
        }
        else
        {
        }
    }
Пример #10
0
    private void bind_req_header()
    {
        Encryption64 e64 = new Encryption64();

        hl_print_request.NavigateUrl = "~/UI/users/print_request.aspx?reqid=" + e64.Encrypt(reqid);
        hl_pdf_request.NavigateUrl   = "~/UI/users/print_request.aspx?reqid=" + e64.Encrypt(reqid) + "&action=pdf";
        //setting labels and InfoBox
        lbl_requestor.Text = "(Request by- " + m_users.getFullnameByuserid(req_row.reqfrom) + ")";
        ds_analytics.projectsRow prj_row = projects.getProjectByPrjid(req_row.projectid)[0];
        lbl_project.Text      = prj_row.projectname;
        lbl_prj_type.Text     = prj_row.projecttype;
        lbl_prj_category.Text = prj_row.projectcategory;
        lbl_prj_brand.Text    = prj_row.projectbrand;
        lbl_typeanalysis.Text = req_row.analysistype;
        lbl_requestid.Text    = req_row.reqid;
        lbl_lead.Text         = m_users.getFullnameByuserid(req_row.responsible);
        lbl_typerequest.Text  = req_row.reqtype;

        lbl_status.Text = other.getStatustext(req_row.statusid);
        tb_addinfo.Text = req_row.req_cmnt;
    }
Пример #11
0
    protected void gv_reqs_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.CssClass = "row";
            string userid = Convert.ToString(Session["userid"]);

            Encryption64 e64 = new Encryption64();

            HyperLink hl_reqno = ((HyperLink)e.Row.Cells[1].FindControl("hl_reqno"));
            hl_reqno.NavigateUrl = "~/UI/admin/view_request.aspx?re=" + e64.Encrypt(hl_reqno.Text) + "&us=" + e64.Encrypt(userid);

            ImageButton imgBtnPDF = ((ImageButton)e.Row.Cells[0].FindControl("imgBtn_PDF"));
            imgBtnPDF.OnClientClick = "javascript:OpenPDFpopup('" + e64.Encrypt(hl_reqno.Text) + "')";

            e.Row.Cells[2].Text = projects.getProjectNameByProjectID(Convert.ToInt64(e.Row.Cells[2].Text));
            e.Row.Cells[4].Text = m_users.getFullnameByuserid(e.Row.Cells[4].Text);
            e.Row.Cells[5].Text = m_users.getFullnameByuserid(e.Row.Cells[5].Text);
            e.Row.Cells[6].Text = other.getStatustext(Convert.ToInt32(e.Row.Cells[6].Text));
        }
    }
Пример #12
0
        public ActionResult AttachmentDelete(string id, string did)
        {
            long attachid  = default(long);
            long docid     = default(long);
            int  delresult = default(int);

            try
            {
                long.TryParse(Encryption64.DecryptQueryString(id), out attachid);
                long.TryParse(Encryption64.DecryptQueryString(did), out docid);
                var obj = DBOperations <AttachmentFile> .GetSpecific(new AttachmentFile()
                {
                    AttachmentID = attachid, Opmode = 1
                }, Constant.usp_Attachment);

                if (System.IO.File.Exists(string.Format(@"{0}\{1}\{2}{3}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docid, obj.FileName, obj.FileExtenssion)))
                {
                    System.IO.File.Delete(string.Format(@"{0}\{1}\{2}{3}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docid, obj.FileName, obj.FileExtenssion));
                }
                delresult = DBOperations <AttachmentFile> .DMLOperation(new AttachmentFile()
                {
                    DocID = docid, AttachmentID = attachid, Opmode = 5
                }, Constant.usp_Attachment, DMLOperationFlag.Delete);

                if (delresult > default(int))
                {
                    return(Json(new { Success = 1, Message = string.Format("Attachement file ({0}{1}) has been deleted successfully", obj.FileName, obj.FileExtenssion) }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    throw new Exception(string.Format("Unable to delete file ({0}{1})", obj.FileName, obj.FileExtenssion));
                }
            }
            catch (Exception ex)
            {
                Utility.Logger(ex);
                return(Json(new { Success = default(int), Message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #13
0
    protected void gv_requests_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.CssClass = "row";

            //From
            e.Row.Cells[5].Text = m_users.getFullnameByuserid(e.Row.Cells[5].Text);
            //To
            e.Row.Cells[6].Text = m_users.getFullnameByuserid(e.Row.Cells[6].Text);
            //Status
            e.Row.Cells[8].Text = other.getStatustext(Convert.ToInt32(e.Row.Cells[8].Text));
            //View Request
            string req_id = Convert.ToString(gv_requests.DataKeys[e.Row.RowIndex].Value);
            string userid = Convert.ToString(Session["userid"]);

            Encryption64 e64 = new Encryption64();
            string       url = "view_request.aspx?re=" + e64.Encrypt(req_id.ToString()) + "&us=" + e64.Encrypt(userid);

            ImageButton ib_view = ((ImageButton)e.Row.FindControl("imgbtn_View"));
            ib_view.Attributes.Add("onclick", "javascript:window.open('" + url + "');");
        }
    }
Пример #14
0
        public ActionResult New(string id = "")
        {
            long     docid          = default(long);
            Document obj            = new Document();
            var      lstDepartments = new List <SelectLists>();

            try
            {
                IEnumerable <long> deptLst = GlobalSettings.oUserPermission.Select(d => d.DeptID);

                if (!string.IsNullOrEmpty(id))
                {
                    long.TryParse(Encryption64.DecryptQueryString(id), out docid);
                }

                if (docid > default(long))
                {
                    obj = DBOperations <Document> .GetSpecific(new Document()
                    {
                        DocID = docid, Opmode = 1
                    }, Constant.usp_DocumentManager);
                }

                //ViewBag.Projects = new DropdownClient().Getdropdown(Dropdown.Project);
                //ViewBag.Departments = new DropdownClient().Getdropdown(Dropdown.Department);
                //ViewBag.SubTypes = new DropdownClient().Getdropdown(Dropdown.SubType);
                //ViewBag.FinYears = new DropdownClient().Getdropdown(Dropdown.FinYear);

                //lstDepartments.Add(new SelectLists() { Value = 0, Text = "Select Department" });
                lstDepartments.AddRange(new DropdownClient().Getdropdown(Dropdown.Department));
                ViewBag.Departments = (GlobalSettings.oUserData.RoleID != (long)Role.BuiltinAdmin ? lstDepartments.Where(w => deptLst.Contains(w.Value) || w.Value == 0).ToList() : lstDepartments);

                ViewBag.FinYears = new DropdownClient().Getdropdown(Dropdown.FinYear);
            }
            catch (Exception) { }
            return(View("New", obj));
        }
Пример #15
0
        public FileResult DowloadUnsupportedFile(string id)
        {
            long attachid = default(long);
            var  obj      = new AttachmentFile();

            try
            {
                long.TryParse(Encryption64.DecryptQueryString(id), out attachid);
                obj = DBOperations <AttachmentFile> .GetSpecific(new AttachmentFile()
                {
                    AttachmentID = attachid, Opmode = 1
                }, Constant.usp_Attachment);

                //var stream = new FileStream(Server.MapPath(obj.FilePath), FileMode.Open);
                var stream = new FileStream(obj.FilePath, FileMode.Open);
                //Utility.Logger(attachid.ToString());
                return(File(stream, MediaTypeNames.Application.Octet, string.Format("{0}{1}", obj.FileName, obj.FileExtenssion)));
            }
            catch (Exception ex)
            {
                Utility.Logger(ex);
                return(null);
            }
        }
Пример #16
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        no_samples       = Convert.ToInt32(e64.Decrypt(Request.QueryString.Get("nosample").Replace(" ", "+")));
        no_tests         = Convert.ToInt32(e64.Decrypt(Request.QueryString.Get("notest").Replace(" ", "+")));
        userid           = Session["userid"].ToString();
        no_samples_intab = int.Parse(System.Configuration.ConfigurationManager.AppSettings["no_samples_intab"].ToString());

        if (!IsPostBack)
        {
            ((MenuItem)((Menu)Master.FindControl("Menu1")).FindItem("Make Request")).Selected = true;
            lbl_status.Text = other.getStatustext(1);
            rtype           = e64.Decrypt(Request.QueryString.Get("rtype").Replace(" ", "+"));

            set_page_ddl();
            set_page_samples();
            set_page_tests();

            build_dt_test_sample();
            build_gv_test_sample();
            bind_gv_test_sample();
            Page.Validate();
        }
        else
        {
            rtype = Request.Form[ddl_typerequest.UniqueID];
            set_page_samples();

            //rebuilding dynamic controls with same ID is necessary on each postback
            build_gv_test_sample();

            //showing validators in each postback
            Page.Validate();
        }
    }
Пример #17
0
        public ActionResult AttachmentPreview(string id, string iseditargument)
        {
            long           attachid      = default(long);
            int            iseditrequest = default(int);
            AttachmentFile obj           = new AttachmentFile();

            try
            {
                long.TryParse(Encryption64.DecryptQueryString(id), out attachid);
                obj = DBOperations <AttachmentFile> .GetSpecific(new AttachmentFile()
                {
                    AttachmentID = attachid, Opmode = 1
                }, Constant.usp_Attachment);

                int.TryParse(Encryption64.DecryptQueryString(iseditargument), out iseditrequest);
                Tuple <AttachmentFile, int> tpl = new Tuple <AttachmentFile, int>(obj, iseditrequest);
                return(View("AttachmentViewer", tpl));
            }
            catch (Exception ex)
            {
                Utility.Logger(ex);
                return(null);
            }
        }
Пример #18
0
 private static string DecryptString(string input)
 {
     return(Encryption64.DecryptString(input, EncryptionKey));
 }
Пример #19
0
    protected void ddl_typerequest_SelectedIndexChanged(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        Response.Redirect("~/UI/users/request2.aspx?nosample=" + e64.Encrypt(no_samples.ToString()) + "&notest=" + e64.Encrypt(no_tests.ToString()) + "&rtype=" + e64.Encrypt(ddl_typerequest.SelectedValue));
    }
Пример #20
0
    private void do_mail(string mode, string submitted_reqid)
    {
        ds_analytics.requestsDataTable req_dt            = requests.getRequestbyReqid(submitted_reqid);
        ds_analytics.requestsRow       submitted_req_row = req_dt[0];
        ds_analytics.m_usersRow        requestor_row     = m_users.getUserByUserid(submitted_req_row.reqfrom)[0];
        string sub = "";

        if (mode == "edit")
        {
            sub = "Analytics: Request " + submitted_req_row.reqid + " resubmitted by " + requestor_row.fullname;
        }
        else if (mode == "copy")
        {
            sub = "Analytics: New Request " + submitted_req_row.reqid + " raised by " + requestor_row.fullname;
        }

        string from;

        if (requestor_row.email != "")
        {
            from = requestor_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/process_request1.aspx", "Mailer/reqsubmit.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        //mail to receiver
        ds_analytics.m_usersRow rec_row = m_users.getUserByUserid(ddl_lead.SelectedValue)[0];
        if (rec_row != null && rec_row.email != "")
        {
            //1. Creating login page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            int    len      = url.IndexOf("UI");
            string base_url = url.Substring(0, len);
            base_url = base_url + "Default.aspx?login="******"&redirect=";
            //2. Creating request page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            len = url.IndexOf("process_request1");
            string       redirect_url = url.Substring(0, len);
            Encryption64 e64          = new Encryption64();
            redirect_url = redirect_url + "reqaction.aspx?reqid=" + e64.Encrypt(submitted_req_row.reqid);
            //3. Adding login + redirect link
            string web_link = "<a href='" + base_url + redirect_url + "' target='_blank'>Open Request</a>";
            body = body.Replace("!!~receiver_name~!!", rec_row.fullname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", requestor_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "You can open the request at " + web_link);

            string[]      to       = { rec_row.email };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }
Пример #21
0
    private void do_mail()
    {
        ds_analytics.m_usersRow req_row = m_users.getUserByUserid(userid)[0];
        string sub = "Analytics: New Request " + reqid + " raised by " + req_row.fullname;
        string from;

        if (req_row.email != "")
        {
            from = req_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/request2.aspx", "Mailer/reqsubmit.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        //mail to receiver
        ds_analytics.m_usersRow rec_row = m_users.getUserByUserid(ddl_lead.SelectedValue)[0];
        if (rec_row != null && rec_row.email != "")
        {
            //1. Creating login page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            int    len      = url.IndexOf("UI");
            string base_url = url.Substring(0, len);
            base_url = base_url + "Default.aspx?login="******"&redirect=";
            //2. Creating request page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            len = url.IndexOf("request2");
            string       redirect_url = url.Substring(0, len);
            Encryption64 e64          = new Encryption64();
            redirect_url = redirect_url + "reqaction.aspx?reqid=" + e64.Encrypt(reqid);
            //3. Adding login + redirect link
            string web_link = "<a href='" + base_url + redirect_url + "' target='_blank'>Open Request</a>";
            body = body.Replace("!!~receiver_name~!!", rec_row.fullname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", req_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "You can open the request at " + web_link);

            string[]      to       = { rec_row.email };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }

        //mail to Backup-ID
        body = pagedata;
        DataTable dt_bke = other.getDropdownsbyType("backupemail");

        if (dt_bke.Rows.Count > 0)
        {
            DataTable dt_bkn     = other.getDropdownsbyType("backupname");
            string    backupname = "";
            if (dt_bkn.Rows.Count > 0)
            {
                backupname = dt_bkn.Rows[0]["value"].ToString();
            }
            body = body.Replace("!!~receiver_name~!!", backupname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", req_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "");

            string[]      to       = { dt_bke.Rows[0]["value"].ToString() };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }
Пример #22
0
        public JsonResult SaveData(UserPermissionMaster postData)
        {
            long accessid = default(long);

            try
            {
                if (postData == null)
                {
                    throw new Exception("No data found for insert");
                }

                long.TryParse(Encryption64.DecryptQueryString(postData.EncryptedAccessID), out accessid);
                postData.AccessID = accessid;
                postData.Opmode   = accessid > default(int) ? 5 : 0;

                UserPermissionMaster obj = new UserPermissionMaster();
                obj.UserID        = postData.UserID;
                obj.OrgID         = postData.OrgID;
                obj.LocationID    = postData.LocationID;
                obj.SublocationID = postData.SublocationID;
                obj.DeptID        = postData.DeptID;
                obj.ProjectID     = postData.ProjectID;
                obj.SubTypeID     = postData.SubTypeID;
                obj.AccessID      = accessid;

                if (postData.Opmode == 0) //add
                {
                    obj.Opmode = 1;
                }
                else
                {
                    obj.Opmode = 6; // edit
                }

                //  var countid = default(long);
                if (postData.Opmode == 0) // add
                {
                    var objcount = new UserPermissionMaster();

                    objcount = DBOperations <UserPermissionMaster> .GetSpecific(obj, Constant.usp_UserPermissionMaster);

                    if (objcount.AccessID > default(long))
                    {
                        throw new Exception("Permission already exist");
                    }
                    else
                    {
                        var result = DBOperations <UserPermissionMaster> .DMLOperation(postData, Constant.usp_UserPermissionMaster);

                        if (result > default(int))
                        {
                            return(Json(new { Success = 1, Message = string.Format("Data have been {0} successfully", accessid > default(long) ? "updated" : "saved") }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            throw new Exception("Operation has been failed to execute");
                        }
                    }
                }
                else // edit
                {
                    var objcount = new UserPermissionMaster();

                    objcount = DBOperations <UserPermissionMaster> .GetSpecific(obj, Constant.usp_UserPermissionMaster);

                    if (objcount.AccessID > default(long))
                    {
                        throw new Exception("Permission already exist");
                    }
                    else
                    {
                        var result = DBOperations <UserPermissionMaster> .DMLOperation(postData, Constant.usp_UserPermissionMaster);

                        if (result > default(int))
                        {
                            return(Json(new { Success = 1, Message = string.Format("Data have been {0} successfully", accessid > default(long) ? "updated" : "saved") }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            throw new Exception("Operation has been failed to execute");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Success = default(int), Message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
        public List<HotelRateAndAvailabilityExt> GetHotelRoomsList()
        {
            List<HotelRateAndAvailabilityExt> HotelRoomsList = new List<HotelRateAndAvailabilityExt>();

            if (HotelRooms.Rows.Count > 0)
            {
                foreach (DataRow dr in HotelRooms.Rows)
                {
                    HotelRateAndAvailabilityExt HotelRoomsObj = new HotelRateAndAvailabilityExt();
                    HotelRoomsObj.ID = Convert.ToInt32(dr["ID"]);
                    HotelRoomsObj.HotelID = Convert.ToInt32(dr["HotelID"]);
                    HotelRoomsObj.RoomTypeID = Convert.ToInt32(dr["RoomTypeID"]);
                    HotelRoomsObj.RoomTypeName = Convert.ToString(dr["RoomTypeName"]);
                    HotelRoomsObj.RoomSize = Convert.ToInt32(dr["RoomSize"]);
                    HotelRoomsObj.MaxPeopleCount = Convert.ToInt32(dr["MaxPeopleCount"]);
                    HotelRoomsObj.IDWithMaxPeopleCount = Convert.ToString(dr["IDWithMaxPeopleCount"]);
                    HotelRoomsObj.MaxChildrenCount = Convert.ToInt32(dr["MaxChildrenCount"]);
                    HotelRoomsObj.BabyCotCount = Convert.ToInt32(dr["BabyCotCount"]);
                    HotelRoomsObj.ExtraBedCount = Convert.ToInt32(dr["ExtraBedCount"]);
                    HotelRoomsObj.SmokingTypeID = Convert.ToString(dr["SmokingTypeID"]);

                    HotelRoomsObj.SmokingTypeName = Convert.ToString(dr["SmokingTypeName"]);
                    HotelRoomsObj.ViewTypeID = Convert.ToString(dr["ViewTypeID"]);
                    HotelRoomsObj.ViewTypeName = Convert.ToString(dr["ViewTypeName"]);
                    HotelRoomsObj.IncludedInRoomTypeCaption = Convert.ToString(dr["IncludedInRoomTypeCaption"]);

                    Encryption64 objEncryptHotelRoomID = new Encryption64();
                    string EncryptHotelRoomID = Convert.ToString(dr["ID"]);
                    EncryptHotelRoomID = System.Web.HttpContext.Current.Server.UrlEncode(ConvertStringToHex(objEncryptHotelRoomID.Encrypt(EncryptHotelRoomID, "58421043")));
                    HotelRoomsObj.EncryptHotelRoomID = EncryptHotelRoomID;

                    HotelRoomsList.Add(HotelRoomsObj);
                }
            }
            return HotelRoomsList;
        }
Пример #24
0
 /// <summary>
 /// Decrypt query string.
 /// </summary>
 /// <param name="encryptedStrings">Encrypted query string.</param>
 /// <param name="key">Key, being used to decrypt.</param>
 /// <remarks>The query string object replaces '+' character with an empty character.</remarks>
 /// <returns></returns>
 public static string DecryptQueryStrings(string encryptedStrings, string key)
 {
     return(Encryption64.Decrypt(encryptedStrings.Replace(" ", "+"), key));
 }
Пример #25
0
        public ActionResult SaveUploadedFile(long deptid, long prjid, long subtype, long finyr, string docno, string id)
        {
            long     docIdentity = default(long);
            DateTime dt          = DateTime.Now;
            var      doc         = new Document();

            string[] viewerSupportedFiles = ConfigurationManager.AppSettings["ViewerJSSupportedExtenssions"].Split(',');
            try
            {
                if (GlobalSettings.oUserData != null && GlobalSettings.oUserData.ID > default(long))
                {
                    long.TryParse(Encryption64.DecryptQueryString(id), out docIdentity);

                    if (docIdentity <= default(long))
                    {
                        doc.DeptID      = deptid;
                        doc.ProjectID   = prjid;
                        doc.SubTypeID   = subtype;
                        doc.FinYearID   = finyr;
                        doc.DocNumber   = !string.IsNullOrWhiteSpace(docno.Trim()) ? docno.Trim().ToUpper() : "DOC-" + dt.ToString("yyyyMMdd") + "_" + dt.ToString("hhmmss");
                        doc.CreatedBy   = GlobalSettings.oUserData.ID;
                        doc.TaggingType = (int)TaggingType.ScanOnly;
                        doc.DocDate     = dt;
                        doc.Opmode      = 2;
                        var docidstr = DBOperations <Document> .InsertWithOutputVariable(doc, Constant.usp_DocumentManager);

                        long.TryParse(docidstr, out docIdentity);
                    }

                    foreach (string fileName in Request.Files)
                    {
                        try
                        {
                            HttpPostedFileBase file = Request.Files[fileName];
                            var contentLength       = file.ContentLength;
                            if (file != null && contentLength > 0)
                            {
                                byte[] imgAsBytes = new byte[contentLength];
                                using (BinaryReader theReader = new BinaryReader(file.InputStream))
                                {
                                    imgAsBytes = theReader.ReadBytes(contentLength);
                                }
                                //if (!Directory.Exists(Server.MapPath(string.Format("~/Uploads/{0}/", docIdentity))))
                                //{
                                //    Directory.CreateDirectory(Server.MapPath(string.Format("~/Uploads/{0}/", docIdentity)));
                                //}
                                //if (System.IO.File.Exists(Server.MapPath(string.Format("~/Uploads/{0}/{1}", docIdentity, file.FileName))))
                                //{
                                //    System.IO.File.Delete(Server.MapPath(string.Format("~/Uploads/{0}/{1}", docIdentity, file.FileName)));
                                //}
                                //System.IO.File.WriteAllBytes(Server.MapPath(string.Format("~/Uploads/{0}/{1}", docIdentity, file.FileName)), imgAsBytes);
                                if (!Directory.Exists(string.Format(@"{0}\{1}\", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity)))
                                {
                                    Directory.CreateDirectory(string.Format(@"{0}\{1}\", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity));
                                }
                                if (System.IO.File.Exists(string.Format(@"{0}\{1}\{2}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity, file.FileName)))
                                {
                                    System.IO.File.Delete(string.Format(@"{0}\{1}\{2}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity, file.FileName));
                                }
                                System.IO.File.WriteAllBytes(string.Format(@"{0}\{1}\{2}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity, file.FileName), imgAsBytes);

                                AttachmentFile a = new AttachmentFile();
                                a.DocID          = docIdentity;
                                a.FileSizeBytes  = contentLength.ToString();
                                a.FileName       = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
                                a.FileExtenssion = System.IO.Path.GetExtension(file.FileName);
                                //a.FilePath = string.Format("~/Uploads/{0}/{1}", docIdentity, file.FileName); // Set Virtual Path in DB
                                a.FilePath          = string.Format(@"{0}\{1}\{2}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docIdentity, file.FileName); // Set Virtual Path in DB
                                a.IsViewerSupported = viewerSupportedFiles.Contains(System.IO.Path.GetExtension(file.FileName)) ? 1 : default(int);
                                a.CreatedOn         = dt;
                                a.CreatedBy         = GlobalSettings.oUserData.ID;
                                a.Opmode            = 2;
                                var result = DBOperations <AttachmentFile> .DMLOperation(a, Constant.usp_Attachment);
                            }
                        }
                        catch (Exception ex)
                        {
                            //continue;
                            throw ex;
                        }
                    }
                    return(Json(new { success = true, docid = Encryption64.EncryptQueryString(docIdentity.ToString()) }));
                }
                else
                {
                    throw new Exception("Session timed-out. Unable to upload. Please login again");
                }
            }
            catch (Exception)
            {
                return(Json(new { success = false, docid = Encryption64.EncryptQueryString(default(long).ToString()) }));
            }
        }
Пример #26
0
        public ActionResult DocumentDelete(string did)
        {
            long docid                = default(long);
            int  docdelresult         = default(int);
            int  delresult            = default(int);
            List <AttachmentFile> lst = new List <AttachmentFile>();
            StringBuilder         sb  = new StringBuilder();

            try
            {
                long.TryParse(Encryption64.DecryptQueryString(did), out docid);
                lst = DBOperations <AttachmentFile> .GetAllOrByRange(new AttachmentFile()
                {
                    DocID = docid, Opmode = default(int)
                }, Constant.usp_Attachment);

                if (lst != null && lst.Count() > default(int))
                {
                    foreach (var attachmentobj in lst)
                    {
                        try
                        {
                            if (System.IO.File.Exists(string.Format(@"{0}\{1}\{2}{3}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docid, attachmentobj.FileName, attachmentobj.FileExtenssion)))
                            {
                                System.IO.File.Delete(string.Format(@"{0}\{1}\{2}{3}", ConfigurationManager.AppSettings["DocumentDomainRootDirectory"], docid, attachmentobj.FileName, attachmentobj.FileExtenssion));
                                delresult = DBOperations <AttachmentFile> .DMLOperation(new AttachmentFile()
                                {
                                    DocID = docid, AttachmentID = attachmentobj.AttachmentID, Opmode = 5
                                }, Constant.usp_Attachment, DMLOperationFlag.Delete);
                            }
                        }
                        catch (Exception ex)
                        {
                            Utility.Logger(ex);
                            sb.AppendLine(ex.Message);
                            continue;
                        }
                    }
                }
                if (string.IsNullOrWhiteSpace(sb.ToString()))
                {
                    docdelresult = DBOperations <Document> .DMLOperation(new Document()
                    {
                        DocID = docid, Opmode = 5
                    }, Constant.usp_DocumentManager, DMLOperationFlag.Delete);

                    if (docdelresult > default(int))
                    {
                        return(Json(new { Success = 1, Message = "Document has been deleted successfully" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        throw new Exception("Unable to delete document right now. Please try again after some time");
                    }
                }
                else
                {
                    throw new Exception(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                Utility.Logger(ex);
                return(Json(new { Success = default(int), Message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #27
0
 /// <summary>
 /// Encode a ecoded string value
 /// </summary>
 /// <param name="encodedvalue"></param>
 /// <returns></returns>
 public static string ToEncoding(string value)
 {
     return(Encryption64.Encrypt(value, "1A2B3C4D").ToLower());
 }
Пример #28
0
 /// <summary>
 /// Decode a ecoded string value
 /// </summary>
 /// <param name="encodedvalue"></param>
 /// <returns></returns>
 public static string ToDecoding(string encodedvalue)
 {
     return(Encryption64.Decrypt(encodedvalue, "1A2B3C4D"));
 }
Пример #29
0
    public static string DecryptQueryString(string strQueryString)
    {
        Encryption64 oES = new Encryption64();

        return(oES.Decrypt(strQueryString, "!#$a54?3"));
    }
        public List<PropertyRoomsExt> GetPropertyRooms(int HotelID)
        {
            // long HotelID = 100003;
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("TB_SP_GetHotelRooms", SQLCon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Culture", CultureValue);
            cmd.Parameters.AddWithValue("@OrderBy", "ID");
            cmd.Parameters.AddWithValue("@HotelID",HotelID);
            cmd.Parameters.AddWithValue("@Active", true);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);
            SQLCon.Close();

            List<PropertyRoomsExt> ListOfModel = new List<PropertyRoomsExt>();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //if (!ArrayID.Contains(Convert.ToInt32(dr["ID"])))
                    //{
                    PropertyRoomsExt HotelRoom = new PropertyRoomsExt();

                    HotelRoom.ID = Convert.ToInt32(dr["ID"]);
                    HotelRoom.HotelID = Convert.ToInt64(dr["HotelID"]);
                    HotelRoom.RoomTypeID = Convert.ToInt32(dr["RoomTypeID"]);
                    HotelRoom.RoomCount = dr["RoomCount"].ToString();

                    HotelRoom.RoomTypeName = dr["RoomTypeName"].ToString();
                    HotelRoom.RoomSize = dr["RoomSize"].ToString();
                    HotelRoom.MaxPeopleCount = dr["MaxPeopleCount"].ToString();

                    HotelRoom.IDWithMaxPeopleCount = dr["IDWithMaxPeopleCount"].ToString();
                    HotelRoom.MaxChildrenCount = dr["MaxChildrenCount"].ToString();
                    HotelRoom.BabyCotCount = dr["BabyCotCount"].ToString();

                    HotelRoom.ExtraBedCount = dr["ExtraBedCount"].ToString();
                    HotelRoom.SmokingTypeID = dr["SmokingTypeID"].ToString();
                    HotelRoom.SmokingTypeName = dr["SmokingTypeName"].ToString();

                    HotelRoom.ViewTypeID = dr["ViewTypeID"].ToString();
                    HotelRoom.ViewTypeName = dr["ViewTypeName"].ToString();
                    HotelRoom.IncludedInRoomTypeCaption = dr["IncludedInRoomTypeCaption"].ToString();

                    HotelRoom.Active = Convert.ToBoolean(dr["Active"]);
                    HotelRoom.CreateDateTime = dr["CreateDateTime"].ToString();
                    HotelRoom.CreateUserID = dr["CreateUserID"].ToString();

                    HotelRoom.OpDateTime = dr["OpDateTime"].ToString();
                    HotelRoom.OpUserID = dr["OpUserID"].ToString();

                    Encryption64 objEncryptreservation = new Encryption64();
                    string EncryptRoomID = dr["ID"].ToString();
                    EncryptRoomID = System.Web.HttpContext.Current.Server.UrlEncode(ConvertStringToHex(objEncryptreservation.Encrypt(EncryptRoomID, "58421043")));
                    HotelRoom.EncryptRoomID = EncryptRoomID;

                    ListOfModel.Add(HotelRoom);
                    //}

                }
            }
            return ListOfModel;
        }
Пример #31
0
    public static string DecryptString(string str)
    {
        Encryption64 oES = new Encryption64();

        return(oES.Decrypt(str, "@n!k$en1"));
    }
        protected async Task Salvar(EditContext editContext)
        {
            if (!editContext.Validate())
            {
                return;
            }

            var usuarioExiste = await UsuariosServico.GetPorEmailAsync(_usuarioViewModel.Email);

            if (_usuarioViewModel.Id == Guid.Empty && usuarioExiste != null)
            {
                ToastService.ShowInfo("Já existe um usuário cadastrado com este email!");
                return;
            }

            if (_senhaEdicao != _usuarioViewModel.Senha)
            {
                _usuarioViewModel.Senha = Encryption64.Encrypt(_usuarioViewModel.Senha);
            }

            switch (_usuarioViewModel.CargoId)
            {
            case CargosConst.Administrador:
                var administrador = Mapper.Map <AdministradorDTO>(_usuarioViewModel);
                await PostOrPutAsync(AdministradoresServico, administrador);

                break;

            case CargosConst.Recepcionista:
                var recepcionista = Mapper.Map <RecepcionistaDTO>(_usuarioViewModel);
                await PostOrPutAsync(RecepcionistasServico, recepcionista);

                break;

            case CargosConst.Laboratorio:
                var laboratorio = Mapper.Map <LaboratorioDTO>(_usuarioViewModel);
                await PostOrPutAsync(LaboratoriosServico, laboratorio);

                break;

            case CargosConst.Medico:
                var medicoExiste = await MedicosServico.GetPorCRMAsync(_usuarioViewModel.CRM);

                if (_usuarioViewModel.Id == Guid.Empty && medicoExiste != null)
                {
                    ToastService.ShowInfo($"O médico {medicoExiste.Nome} já está cadastrado com o CRM {_usuarioViewModel.CRM}!");
                    return;
                }

                if (!_usuarioViewModel.Especialidades.Any())
                {
                    ToastService.ShowInfo("Deve ser selecionado ao menos uma especialidade!");
                    return;
                }

                var horariosSelecionados = _usuarioViewModel.HorariosDeTrabalho.Where(_ => _.Selecionado);
                if (!horariosSelecionados.Any())
                {
                    ToastService.ShowInfo("Deve ser selecionado ao menos um horário de trabalho!");
                    return;
                }

                var medico = Mapper.Map <MedicoDTO>(_usuarioViewModel);
                await PostOrPutAsync(MedicosServico, medico);

                break;

            default:
                ToastService.ShowWarning("O cargo informado é inválido");
                break;
            }
        }