Пример #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                Response.Write("<script>alert( 'Sua sessão expirou!' );top.login();</script>");
                Response.End();
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            if (Request["idField"] != null)
            {
                idField = Convert.ToInt32(Request["idField"]);
            }
            else
            {
                idField = Convert.ToInt32(Session["idField"]);
            }
            Session["idField"] = idField;

            if (Request["idForm"] != null)
            {
                idForm = Convert.ToInt32(Request["idForm"]);
            }
            else
            {
                idForm = Convert.ToInt32(Session["idForm"]);
            }
            Session["idForm"] = idForm;

            txtIDescription.MaxLength = new BsField(idField, new Business.BsForm(idForm)).GetObject().Size;

            if (!IsPostBack)
            {
                if (Request["CommandName"] == "Alter")
                {
                    getData(Convert.ToInt32(Request["id"]));
                }
                else if (Request["CommandName"] == "Exclude")
                {
                    delItensField(Convert.ToInt32(Request["id"]));
                }
                else
                {
                    search();
                }
            }
        }
Пример #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                Response.Write("<script>alert( 'Sua sessão expirou!' );top.login();</script>");
                Response.End();
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            if (!IsPostBack)
            {
                getConfig(new Business.BsItemForm(Convert.ToInt32(Request["idItemForm"]), new BsForm(Convert.ToInt32(Request["idForm"]))));
            }
        }
Пример #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                return;
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            int    idFolder = Convert.ToInt32("0" + Request["idFolder"]);
            int    idParent = Convert.ToInt32("0" + Request["idParent"]);
            string name     = (Request["name"] == null ? "" : Request["name"]);

            if (Request["alter"] != null)
            {
                alterFolder(new BsFolder(idFolder), name);
            }
            else if (Request["count"] != null)
            {
                countChildFolder(new BsFolder(idFolder));
            }
            else if (Request["delete"] != null)
            {
                deleteFolder(new BsFolder(idFolder, name, idParent, null, null, null, null, usr));
            }
            else if (Request["addNew"] != null)
            {
                addFolder(new BsFolder(idFolder, name, idParent, null, null, null, null, usr));
            }
            else if (Request["idFolderNew"] != null)
            {
                alterLocationFolder(new BsFolder(Convert.ToInt32(Request["idFolderNew"])),
                                    new Business.BsFolder(Convert.ToInt32(Request["idFolderChild"])));
            }
            else if (Request["root"] != null)
            {
                reloadRoot();
            }
            else
            {
                ajaxGetFolders(new BsFolder(idFolder, name, idParent, null, null, null, null, usr));
            }
        }
Пример #4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                Response.Write("<script>alert( 'Sua sessão expirou!' );top.login();</script>");
                Response.End();
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            if (!IsPostBack)
            {
                if (Request["idReview"] != null)
                {
                    txtReview.Text = new BsReviewForm(Convert.ToInt32(Request["idReview"]), new BsItemForm(Convert.ToInt32(Request["idItemForm"]), new BsForm(Convert.ToInt32(Request["idForm"])))).GetObject().Review;
                }
            }
        }
Пример #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                return;
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            BsItemForm itemForm = new BsItemForm(Convert.ToInt32("0" + Request["idItemForm"]), new BsForm(Convert.ToInt32("0" + Request["idForm"])));

            if (Request["idReview"] != null && Request["idForm"] != null)
            {
                removeReviewForm(new BsReviewForm(Convert.ToInt32(Request["idReview"]), itemForm));
            }
            else if (Request["idItemForm"] != null && Request["idForm"] != null)
            {
                getReviewsForm(new BsReviewForm(0, itemForm));
            }
        }
Пример #6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                return;
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            int idForm = Convert.ToInt32("0" + Request["idForm"]);

            if (Request["idFolderDrag"] != null)
            {
                alterItemFormFolder();
            }
            else if (Request["idItemForm"] != null && Request["idForm"] != null && Request["getFiles"] != null)
            {
                getFiles(new BsItemForm(Convert.ToInt32(Request["idItemForm"]), new BsForm(idForm)));
            }
            else if (Request["idItemForm"] != null && Request["idForm"] != null && Request["file"] != null)
            {
                removeFile(new BsItemForm(Convert.ToInt32(Request["idItemForm"]), new BsForm(idForm)));
            }
            else if (Request["idFolder"] != null && Request["idForm"] != null)
            {
                getItensForm(new BsForm(idForm, "", new BsFolder(Convert.ToInt32(Request["idFolder"])), null, null, false));
            }
            else if (Request["idRemoveItem"] != null && Request["idForm"] != null)
            {
                removeItemForm(new BsItemForm(Convert.ToInt32(Request["idRemoveItem"]), null, new BsForm(idForm), null, null, null));
            }
            else if (Request["idItemGet"] != null)
            {
                getItemForm(new BsItemForm(Convert.ToInt32(Request["idItemGet"]), null, new BsForm(idForm), null, null, null));
            }
        }
Пример #7
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Business.BsUser.UserOn())
            {
                Response.Write("<script>alert( 'Sua sessão expirou!' );top.login();</script>");
                Response.End();
            }
            else
            {
                usr = Business.BsUser.GetUserOn();
            }

            if (Request["idForm"] != null)
            {
                Session["idForm"] = Request["idForm"];
            }
            form = new Business.BsForm(Convert.ToInt32("0" + Session["idForm"])).GetObject();

            if (Request["idFolder"] != null)
            {
                Session["idFolder"] = Request["idFolder"];
            }
            folder = new Business.BsFolder(Convert.ToInt32("0" + Session["idFolder"]));

            item = new Business.BsItemForm(Convert.ToInt32("0" + Request["idItemForm"]), form);

            if (!Page.IsPostBack)
            {
                if (Request["force"] == null)
                {
                    loadForm();
                }
                else
                {
                    forceDownload(item);
                }
            }
        }
Пример #8
0
 public BsForm(int id_, string name_, BsFolder folder_, BsItensForm itensForm_, BsUser user_, bool anexo_)
 {
     _id        = id_;
     _name      = name_;
     _folder    = folder_;
     _itensForm = itensForm_;
     _user      = user_;
     _anexo     = anexo_;
 }
Пример #9
0
        private void setTextBox(ref HtmlTableRow tbRow, ref BsField f, ref BsItemForm item, ref string calendar, string sId, bool and)
        {
            TextBox t         = new TextBox();
            string  nameCampo = "txtCampo" + f.Id.ToString() + sId;

            t.ID        = nameCampo;
            t.Width     = Unit.Pixel(f.Size * 7);
            t.MaxLength = f.Size;
            t.Attributes.Add("validar", f.Compulsory.ToString().ToLower());
            t.Attributes.Add("msgName", f.Name);

            if (f.Mask.DesMask != "" && f.Mask.Id != 8)
            {
                t.Attributes.Add("onkeypress", "return formatValue( this , '" + f.Mask.DesMask + "' )");
            }
            else if (f.Mask.Id == 8)
            {
                t.Attributes.Add("onkeypress", "return Formata(this,20,event,2)");
            }

            if (item.Id > 0)
            {
                t.Text = item.GFields.GetKey(f).Value;
                BsUser usr = BsUser.GetUserOn();
                if (usr != null && (item.User.Id != usr.Id && !usr.Admin))
                {
                    t.Enabled = f.ExceptionsUser;
                }
            }

            if (and)
            {
                HtmlTableCell tbCelAnd = new HtmlTableCell();
                tbRow.Controls.Add(tbCelAnd);
                tbCelAnd.InnerHtml = "&nbsp;Até&nbsp;";
            }

            if (f.Mask.Id == 5)
            {
                t.Attributes.Add("isDate", "true");
                calendar += "addCalendar(\"c" + nameCampo + "\", \"" + f.Name + "\", \"" + nameCampo + "\", \"Form1\");";

                t.Attributes.Add("onblur", "dateValidate(this)");

                HtmlTableCell tbCel  = new HtmlTableCell();
                HtmlTableCell tbCel2 = new HtmlTableCell();

                tbRow.Controls.Add(tbCel);
                tbRow.Controls.Add(tbCel2);

                tbCel.Width = "1";
                tbCel.Controls.Add(t);
                tbCel2.Attributes.Add("style", "cursor:hand");
                tbCel2.Attributes.Add("onclick", "showCal('c" + nameCampo + "','Form1')");

                HtmlImage img = new HtmlImage();
                img.Src    = "../imagens/calendar.jpg";
                img.Border = 0;

                tbCel2.Controls.Add(img);
            }
            else
            {
                HtmlTableCell tbCel = new HtmlTableCell();
                tbRow.Controls.Add(tbCel);
                tbCel.Controls.Add(t);
            }
        }
Пример #10
0
 public static void SaveForm(int idForm, string name, BsUser u, bool anexo, bool enabledDate, bool enabledUser)
 {
     Database.DaForms.SaveForm(ref idForm, name, u.Id, anexo, enabledDate, enabledUser);
 }
Пример #11
0
 public BsItemForm(int id_, BsFolder folder_, BsForm form_, BsGenericItens gFields_, BsUser user_, BsGroups groups_)
 {
     _id      = id_;
     _folder  = folder_;
     _form    = form_;
     _gFields = gFields_;
     _user    = user_;
     _groups  = groups_;
 }
Пример #12
0
        public bool SendMail(string email, string mensagem, string subject, BsUser u)
        {
            string body       = "";
            string folderPath = "";

            if (_id != 0 && Form.Id != 0)
            {
                this.GetObject();
                BsFields fds = new BsField(this.Form).GetObjects();
                for (int i = 0; i < fds.Count; i++)
                {
                    if (fds[i].Detail)
                    {
                        if (fds[i].Type.Id == 4 || fds[i].TypeObject.Id == 5)
                        {
                            body += "<br>";
                            body += this.GFields.GetKey(fds[i]).Value;
                        }
                        else
                        {
                            string values = this.GFields.GetKey(fds[i]).Value;
                            int    size   = fds[i].Size;
                            if (fds[i].Type.Id == 3)
                            {
                                values = Convert.ToDateTime(values).ToString("dd/MM/yyyy");
                            }

                            body += "<table border=0 cellpadding=0 cellspacing=0 width=\"100%\" ><tr>";
                            body += "<td width=\"70\" ><b>" + fds[i].Name + "</b></td>";
                            body += "<td >" + values + "</td>";
                            body += "</tr></table>";
                        }
                    }
                }

                Form.GetObject();

                BsFolder f = this.Folder;
                f.GetObject();
                if (f.IdParent < 1)
                {
                    folderPath += f.Name + "\\";
                }
                else
                {
                    folderPath = f.Name + "\\" + folderPath;
                    while (f.IdParent > 0)
                    {
                        int idParent = f.IdParent;
                        f.Clear();
                        f.Id = idParent;
                        f.GetObject();
                        folderPath = f.Name + "\\" + folderPath;
                    }
                }

                folderPath += "<u>" + this.Form.Name + "</u>";
            }

            MailMessage mail = new MailMessage();

            try
            {
                mensagem = mensagem.Replace("\r\n", "<br>");
                if (User.Email == "")
                {
                    mail.From = ConfigurationSettings.AppSettings["mailDefault"];
                }
                else
                {
                    mail.From = User.Email;
                }

                mail.Body = "<br>" + mensagem + "<br><hr><br>" + body +
                            "<br><hr><br><b>Data do item: </b>" + this.Date.ToString("dd/MM/yyyy") +
                            "<br><b>Local: </b>" + folderPath;

                mail.To         = email;
                mail.Subject    = subject;
                mail.BodyFormat = MailFormat.Html;

                if (this.Form.Anexo)
                {
                    attachmentFiles(ref mail);
                }

                if (ConfigurationSettings.AppSettings["SMPTSERVER"] != "")
                {
                    SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SMPTSERVER"];
                }

                SmtpMail.Send(mail);
                return(true);
            }
            catch { return(false); }
        }