Esempio n. 1
0
        private BsItemForm setObject(BsItemForm item_, DataRow dr_)
        {
            item_._id = Convert.ToInt32(dr_["idItemForm"]);

            item_.Form.Id    = Convert.ToInt32(dr_["idForm"]);
            item_.Form.Anexo = Convert.ToBoolean(dr_["anexo"]);

            item_.Folder.Id = Convert.ToInt32(dr_["idFolder"]);
            item_._date     = Convert.ToDateTime(dr_["data"]);

            item_.User.Id   = Convert.ToInt32(dr_["idUser"]);
            item_.User.Name = dr_["nameUser"].ToString();

            BsFields fds = new BsField(item_.Form).GetObjects();

            for (int i = 0; i < fds.Count; i++)
            {
                BsGenericItem gItem = new BsGenericItem();
                gItem.Value = dr_["campo" + fds[i].Id].ToString();
                if (fds[i].Type.Id == 3)
                {
                    if (dr_["campo" + fds[i].Id] != DBNull.Value)
                    {
                        gItem.Value = Convert.ToDateTime(gItem.Value).ToString("dd/MM/yyyy");
                    }
                    else
                    {
                        gItem.Value = Convert.ToDateTime("01/01/1911").ToString("dd/MM/yyyy");
                    }
                }
                item_.GFields.Add(fds[i].Id, gItem);
            }
            return(item_);
        }
Esempio n. 2
0
        private void createDropDown(ref HtmlTableCell c2, int i, BsField f, BsItemForm item)
        {
            DropDownList dl = new DropDownList();

            dl.ID = "txtCampo" + f.Id.ToString();
            dl.Attributes.Add("msgName", f.Name);
            dl.Attributes.Add("validar", f.Compulsory.ToString().ToLower());

            Business.BsItensField itens2 = new Business.BsItemField(f).GetObjects();
            for (int x = 0; x < itens2.Count; x++)
            {
                dl.Items.Insert(x, new ListItem(itens2[x].Value, itens2[x].Value + ""));
            }
            dl.Items.Insert(0, new ListItem("[Selecione]", "0"));

            if (item.Id > 0)
            {
                if (dl.Items.Contains(dl.Items.FindByValue(item.GFields.GetKey(f).Value)))
                {
                    dl.SelectedValue = item.GFields.GetKey(f).Value.Trim();
                }

                BsUser usr = BsUser.GetUserOn();
                if (usr != null && (item.User.Id != usr.Id && !usr.Admin))
                {
                    dl.Enabled = f.ExceptionsUser;
                }
            }

            c2.Controls.Add(dl);
        }
Esempio n. 3
0
        private BsField setObject(BsField f_, DataRow dr_)
        {
            f_._id         = Convert.ToInt32(dr_["idField"]);
            f_._name       = dr_["name"].ToString();
            f_._sizeField  = Convert.ToInt32(dr_["sizeField"]);
            f_._compulsory = Convert.ToBoolean(dr_["compulsory"]);
            f_._preview    = Convert.ToBoolean(dr_["preview"]);
            f_._detail     = Convert.ToBoolean(dr_["detail"]);
            f_._exceptions = Convert.ToBoolean(dr_["exceptions"]);
            f_._orders     = Convert.ToInt32(dr_["orders"]);

            f_.Form.Id   = Convert.ToInt32(dr_["idForm"]);
            f_.Form.Name = dr_["nameForm"].ToString();

            f_.Type.Id = Convert.ToInt32(dr_["idType"]);

            f_.TypeObject.Id          = Convert.ToInt32(dr_["idObject"]);
            f_.TypeObject.Description = dr_["descriptionObject"].ToString();

            f_.Mask.Id          = Convert.ToInt32(dr_["idMask"]);
            f_.Mask.Description = dr_["descriptionMask"].ToString();
            f_.Mask.DesMask     = dr_["descMask"].ToString();

            return(f_);
        }
Esempio n. 4
0
        public BsGroups GetObjectsByFields()
        {
            DataTable dt = Database.DaGroups.GetGroupsByFields(
                _id,
                _description,
                BsField.ConvertToArrayFields(Fields)
                );

            return(addObjectsList(dt));
        }
Esempio n. 5
0
        private void getItemForm(BsItemForm item)
        {
            item.GetObject();
            Business.BsFields fds = new Business.BsField(item.Form).GetObjects();

            if (item.Id > 0)
            {
                string htm = "";
                if (item.Form.GetObject().Anexo)
                {
                    htm = item.ListDirectoryAnexos(false);
                }
                createPageXML();
                Response.Write("<return>");
                for (int i = 0; i < fds.Count; i++)
                {
                    if (fds[i].Detail)
                    {
                        if (fds[i].Type.Id == 4 || fds[i].TypeObject.Id == 5)
                        {
                            htm += "<br>";
                            htm += item.GFields.GetKey(fds[i]).Value;
                        }
                        else
                        {
                            string values = item.GFields.GetKey(fds[i]).Value;
                            int    size   = fds[i].Size;
                            if (fds[i].Type.Id == 3)
                            {
                                values = Convert.ToDateTime(values).ToString("dd/MM/yyyy");
                            }

                            htm += "<table border=0 cellpadding=0 cellspacing=0 width=\"100%\" ><tr>";
                            htm += "<td width=\"50\" nowRap=\"true\"><b><nobr>" + fds[i].Name + "&nbsp;</nobr></b></td>";
                            htm += "<td >" + values + "</td>";
                            htm += "</tr></table>";
                        }
                    }
                }

                htm = htm.Replace("\n", "<br>");
                Response.Write(Server.HtmlEncode(htm));
                Response.Write("</return>");

                Response.Write("<idItem>");
                Response.Write(item.Id.ToString());
                Response.Write("</idItem>");

                Response.Write("<idForm>");
                Response.Write(item.Form.Id.ToString());
                Response.Write("</idForm>");
                closePageXML();
            }
        }
Esempio n. 6
0
 public BsGenericItem GetKey(BsField f)
 {
     for (int x = 0; x < this.Count; x++)
     {
         DictionaryEntry dE = ( DictionaryEntry )this.List[x];
         if (dE.Key.Equals(f.Id))
         {
             return(( BsGenericItem )dE.Value);
         }
     }
     return(null);
 }
Esempio n. 7
0
 public void AddGroupsByField(BsGroups gs_, BsField field_)
 {
     if (field_.Id <= 0)
     {
         throw new Exception("id field not found");
     }
     Database.DaGroups.DelGroupsByFieldId(field_.Id);
     for (int i = 0; i < gs_.Count; i++)
     {
         Database.DaGroups.AddGroupField(field_.Id, gs_[i].Id);
     }
 }
Esempio n. 8
0
        private void createCheckBox(ref HtmlTableCell c2, int i, BsField f, BsItemForm item)
        {
            HtmlTable    table = new HtmlTable();
            HtmlTableRow tr    = new HtmlTableRow();

            Business.BsItemField iten1 = new Business.BsItemField();
            iten1.Field.Id = f.Id;
            Business.BsItensField itens1 = iten1.GetObjects();

            for (int x = 0; x < itens1.Count; x++)
            {
                HtmlTableCell td  = new HtmlTableCell();
                HtmlTableCell td2 = new HtmlTableCell();
                td2.InnerText = itens1[x].Value;

                HtmlInputCheckBox cb = new HtmlInputCheckBox();
                cb.ID   = "txtCampo" + f.Id + "-" + x;
                cb.Name = "txtCampo" + f.Id;
                cb.Attributes.Add("msgName", f.Name);
                cb.Attributes.Add("validar", f.Compulsory.ToString().ToLower());
                cb.Value = itens1[x].Value;

                td.Controls.Add(cb);
                tr.Controls.Add(td);
                tr.Controls.Add(td2);

                if (item.Id > 0)
                {
                    string[] arrValues = item.GFields.GetKey(f).Value.Split(new Char[] { ',' });
                    for (int j = 0; j < arrValues.Length; j++)
                    {
                        if (cb.Value == arrValues[j].Replace("&nbsp;", ""))
                        {
                            cb.Checked = true;
                        }
                    }

                    BsUser usr = BsUser.GetUserOn();
                    if (usr != null && (item.User.Id != usr.Id && !usr.Admin))
                    {
                        cb.Disabled = !f.ExceptionsUser;
                    }
                }
            }

            table.Controls.Add(tr);
            c2.Controls.Add(table);
        }
Esempio n. 9
0
        private BsItemForm saveForm()
        {
            Business.BsFields fds = new Business.BsField(form).GetObjects();
            item.Form   = form;
            item.Folder = folder;
            item.Id     = Convert.ToInt32(txtId.Text);

            string values = "";

            for (int i = 0; i < fds.Count; i++)
            {
                if (fds[i].TypeObject.Id != 3)
                {
                    item.GFields.Add(fds[i].Id, new Business.BsGenericItem(Request["txtCampo" + fds[i].Id]));
                }
                else
                {
                    BsItensField itsf = new BsItemField(fds[i]).GetObjects();
                    for (int x = 0; x < itsf.Count; x++)
                    {
                        string returns = Request["txtCampo" + fds[i].Id + "-" + x];
                        if (returns != "" && returns != null)
                        {
                            values += returns + ",&nbsp;";
                        }
                    }

                    if (values != "")
                    {
                        values = values.Substring(0, values.Length - 7);
                    }
                    item.GFields.Add(fds[i].Id, new Business.BsGenericItem(values));
                }
            }

            item.User = usr;
            item.SaveObject();
            if (Convert.ToInt32("0" + txtId.Text) == 0)
            {
                item.Group.AddGroupsByItemForm(usr.Groups, item);
            }

            return(item);
        }
Esempio n. 10
0
        private string createTextBox(ref HtmlTableCell c2, int i, BsField f, BsItemForm item, bool activeSearch)
        {
            string       calendar = "";
            HtmlTable    tb       = new HtmlTable();
            HtmlTableRow tbRow    = new HtmlTableRow();

            setTextBox(ref tbRow, ref f, ref item, ref calendar, "", false);
            if (activeSearch && (f.Type.Id == 3 || f.Type.Id == 7 || f.Type.Id == 9))
            {
                setTextBox(ref tbRow, ref f, ref item, ref calendar, "-End", true);
            }

            tb.Border      = 0;
            tb.CellPadding = 0;
            tb.CellSpacing = 0;
            tb.Controls.Add(tbRow);
            c2.Controls.Add(tb);

            return(calendar);
        }
Esempio n. 11
0
        private void createListBox(ref HtmlTableCell c2, int i, BsField f, BsItemForm item)
        {
            ListBox tl = new ListBox();

            tl.ID            = "txtCampo" + f.Id.ToString();
            tl.SelectionMode = ListSelectionMode.Multiple;
            tl.Attributes.Add("msgName", f.Name.ToString());
            tl.Attributes.Add("validar", f.Compulsory.ToString().ToLower());

            Business.BsItensField itens3 = new Business.BsItemField(f).GetObjects();
            for (int x = 0; x < itens3.Count; x++)
            {
                tl.Items.Insert(x, new ListItem(itens3[x].Value, itens3[x].Value + ""));
            }

            if (item.Id > 0)
            {
                for (int t = 0; t < tl.Items.Count; t++)
                {
                    string[] arrValues = item.GFields.GetKey(f).Value.Split(new Char[] { ',' });
                    for (int j = 0; j < arrValues.Length; j++)
                    {
                        if (tl.Items[t].Value == arrValues[j])
                        {
                            tl.Items[t].Selected = true;
                        }
                    }
                }

                BsUser usr = BsUser.GetUserOn();
                if (usr != null && (item.User.Id != usr.Id && !usr.Admin))
                {
                    tl.Enabled = f.ExceptionsUser;
                }
            }

            c2.Controls.Add(tl);
        }
Esempio n. 12
0
        private void createRadioButton(ref HtmlTableCell c2, int i, BsField f, BsItemForm item)
        {
            RadioButtonList rbu = new RadioButtonList();

            rbu.RepeatColumns   = 5;
            rbu.RepeatDirection = RepeatDirection.Horizontal;
            rbu.ID = "txtCampo" + f.Id.ToString();
            rbu.Attributes.Add("msgName", f.Name);
            rbu.Attributes.Add("validar", f.Compulsory.ToString());

            Business.BsItemField iten = new Business.BsItemField();
            iten.Field.Id = f.Id;
            Business.BsItensField itens = iten.GetObjects();
            for (int x = 0; x < itens.Count; x++)
            {
                rbu.Items.Insert(x, new ListItem(itens[x].Value, itens[x].Value + ""));
            }
            if (itens.Count > 0)
            {
                rbu.Items[0].Selected = true;
            }

            if (item.Id > 0)
            {
                if (rbu.Items.Contains(rbu.Items.FindByValue(item.GFields.GetKey(f).Value)))
                {
                    rbu.SelectedValue = item.GFields.GetKey(f).Value;
                }

                BsUser usr = BsUser.GetUserOn();
                if (usr != null && (item.User.Id != usr.Id && !usr.Admin))
                {
                    rbu.Enabled = f.ExceptionsUser;
                }
            }

            c2.Controls.Add(rbu);
        }
Esempio n. 13
0
        private void createTextBoxMulti(ref HtmlTableCell c2, int i, BsField f, BsItemForm item)
        {
            TextBox textMult = new TextBox();

            textMult.Width    = Unit.Pixel(400);
            textMult.Height   = Unit.Pixel(150);
            textMult.TextMode = TextBoxMode.MultiLine;
            textMult.ID       = "txtCampo" + f.Id.ToString();
            textMult.Attributes.Add("msgName", f.Name);
            textMult.Attributes.Add("validar", f.Compulsory.ToString().ToLower());

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

            c2.Controls.Add(textMult);
        }
Esempio n. 14
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); }
        }
Esempio n. 15
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);
            }
        }
Esempio n. 16
0
        private void getItensForm(BsForm f)
        {
            string ordem = Convert.ToString(Session["ordem"]);

            if (ordem == null)
            {
                ordem = "desc";
            }
            else
            {
                if (ordem == "asc")
                {
                    ordem = "desc";
                }
                else
                {
                    ordem = "asc";
                }
            }

            Session["ordem"] = ordem;

            Business.BsFields fds = new Business.BsField(f).GetObjects();
            createPageXML();
            string htm = "<TABLE  BORDER=\"1\" bordercolor=\"#ffffff\" width=\"100%\" CELLSPACING=\"2\" CELLPADDING=\"3\">" +
                         "<TR  height=\"20\">" +
                         "<TD background=\"imagens/bordaForm.gif\" width=\"1\" ></TD>" +
                         "<TD background=\"imagens/bordaForm.gif\" width=\"1\" ></TD>";

            BsFields filds      = new BsFields();;
            bool     exceptions = false;

            for (int i = 0; i < fds.Count; i++)
            {
                if (fds[i].Preview)
                {
                    htm += "<TD onmousedown=\"createMenu(4);\" background=\"imagens/bordaForm.gif\" title=\"Clique no campo para organizar em ordem " + (ordem != "asc" ? "ascendente" : "decrescente") + " \" width=\"" + (fds[i].Size * 7) + "\" ><a href=\"javascript:openItemForm( 'tbChild" + f.Id + "', 'block','campo" + fds[i].Id + "' )\"><b>" + fds[i].Name.Replace(":", "") + "</b></a></TD>";
                    filds.Add(fds[i].Id, fds[i]);
                    if (fds[i].ExceptionsUser)
                    {
                        exceptions = true;
                    }
                }
            }

            f.GetObject();

            if (f.EnabledUser)
            {
                htm += "<TD onmousedown=\"createMenu(4);\" background=\"imagens/bordaForm.gif\" title=\"Clique no campo para organizar em ordem " + (ordem != "asc" ? "ascendente" : "decrescente") + " \" width=\"20\" ><a href=\"javascript:openItemForm( 'tbChild" + f.Id + "', 'block','idUser' )\"><b>Usuário</b></a></TD>";
            }
            if (f.EnabledDate)
            {
                htm += "<TD onmousedown=\"createMenu(4);\" background=\"imagens/bordaForm.gif\" title=\"Clique no campo para organizar em ordem " + (ordem != "asc" ? "ascendente" : "decrescente") + " \" width=\"15\" ><a href=\"javascript:openItemForm( 'tbChild" + f.Id + "', 'block','data' )\"><b>Data</b></a></TD>";
            }
            if (f.Anexo)
            {
                htm += "<TD onmousedown=\"createMenu(4);\" background=\"imagens/bordaForm.gif\" width=\"20\" ><b>Anexo</b></TD>";
            }

            htm += "</TR>";

            string field = Convert.ToString(Request["field"]);

            string where = Request["where"];

            BsItensForm itens;

            if (field.Length > 2)
            {
                ordem = field + " " + ordem;
            }
            else
            {
                ordem = "";
            }

            if (usr.Admin)
            {
                itens = new BsItemForm(0, f.Folder, f, null, null, null).GetObjects(ordem, where);
            }
            else
            {
                itens = new BsItemForm(0, f.Folder, f, null, null, usr.Groups).GetObjectsByGroups(ordem, where);
            }

            for (int j = 0; j < itens.Count; j++)
            {
                htm += "<TR style=\"cursor:hand\" bgcolor=\"#ffffff\" id=\"tbItem" + itens[j].Id + "-" + f.Id + "\" idItem=" + itens[j].Id + " idUser="******" exceptions=\"" + exceptions.ToString().ToLower() + "\"  ondblClick=\"EditService( " + itens[j].Id + "," + itens[j].User.Id + "," + f.Id + " )\"  >";
                htm += "<TD width=\"1\" onmousedown=\"createMenuItem();openItem(" + itens[j].Id + ", " + f.Id + ")\" ><img alt=\"Clique e arraste para mover\" width=10 height=10 src=\"imagens/move.gif\" style=\"cursor:move\" onmousedown=\"startDrag('" + itens[j].Id + "','" + itens[j].User.Id + "','Item')\" ></TD>";
                htm += "<TD width=\"1\" onmousedown=\"createMenuItem();openItem(" + itens[j].Id + ", " + f.Id + ")\" ><img alt=\"Clique para abrir os Comentários\" id=\"imgReviews" + itens[j].Id + "-" + itens[j].Form.Id + "\" width=10 height=10 src=\"imagens/setMCima.gif\" style=\"cursor:hand\" onclick=\"openReviewsForm(" + itens[j].Id + ", " + itens[j].Form.Id + ", '', '')\" ></TD>";

                for (int i = 0; i < filds.Count; i++)
                {
                    htm += "<TD onmousedown=\"createMenuItem();openItem(" + itens[j].Id + ", " + f.Id + ")\" >" + itens[j].GFields.GetKey(filds[i]).Value + "</TD>";
                }

                if (f.EnabledDate)
                {
                    htm += "<TD width=\"20\" onmousedown=\"createMenuItem();openItem(" + itens[j].Id + ", " + f.Id + ")\" >" + itens[j].User.Name + "</TD>";
                }
                if (f.EnabledUser)
                {
                    htm += "<TD width=\"15\" onmousedown=\"createMenuItem();openItem(" + itens[j].Id + ", " + f.Id + ")\" >" + itens[j].Date.ToString("dd/MM/yyyy") + "</TD>";
                }
                if (f.Anexo)
                {
                    htm += "<TD width=\"5\" onmousedown=\"createMenu(5);\" >" + (itens[j].ContaisFiles()? "<img src=\"imagens/anexo.gif\">" : "") + "</TD>";
                }
                htm += "</TR>";

                htm += "<TR style=\"display:none\" id=\"itemFormReview" + itens[j].Id + "-" + itens[j].Form.Id + "\" ><TD width=\"10\" bgcolor=\"#F8F5F0\" >&nbsp;</TD><TD width=\"10\" bgcolor=\"#F8F5F0\" >&nbsp;</TD><TD colspan=\"100%\"><nobr><img width=\"10\" height=\"10\" src=\"imagens/26-1.gif\"> Carregando...</nobr></TD></TR>";
            }

            htm += "</TABLE>";

            Response.Write("<return>");
            Response.Write(Server.HtmlEncode(htm));
            Response.Write("</return>");

            Response.Write("<countItem>");
            Response.Write(itens.Count + "");
            Response.Write("</countItem>");

            closePageXML();
        }
Esempio n. 17
0
        public void SaveObject()
        {
            BsFields fds   = new BsField(Form).GetObjects();
            string   query = "";

            if (_id == 0)
            {
                query = "insert into tbFrm" + Form.Id + "";
                string fields = "(";
                string values = "values(";

                for (int i = 0; i < fds.Count; i++)
                {
                    fields += "campo" + fds[i].Id + ",";
                    string fieldValue = GFields.GetKey(fds[i]).Value;

                    if (fds[i].Type.Id == 3)
                    {
                        DateTime dtime = Convert.ToDateTime(fieldValue);
                        values += "'" + dtime.ToString("yyyy/MM/dd") + "',";
                    }
                    else if (fds[i].Type.Id == 7)
                    {
                        values += "" + fieldValue.Replace(".", "").Replace(",", ".") + ",";
                    }
                    else
                    {
                        values += "'" + fieldValue + "',";
                    }
                }

                query += fields + " idFolder, idForm, idUser )" + values + Folder.Id + ", " + Form.Id + ", " + User.Id + " )";
                query += "; select @@identity";
            }
            else
            {
                query = "update tbFrm" + Form.Id + " set ";

                for (int i = 0; i < fds.Count; i++)
                {
                    string fieldValue = GFields.GetKey(fds[i]).Value;
                    if (fieldValue != "***")
                    {
                        if (fds[i].Type.Id == 3)
                        {
                            DateTime dtime = Convert.ToDateTime(fieldValue);
                            query += "campo" + fds[i].Id + " = '" + dtime.ToString("yyyy/MM/dd") + "',";
                        }
                        else if (fds[i].Type.Id == 7)
                        {
                            query += "campo" + fds[i].Id + " = " + fieldValue.Replace(".", "").Replace(",", ".") + ",";
                        }
                        else
                        {
                            query += "campo" + fds[i].Id + " = '" + fieldValue + "',";
                        }
                    }
                }

                query += " idFolder = " + Folder.Id + " where idItemForm= " + _id;
                query += "; select " + _id + "";
            }

            Database.DaItensForms.SaveItem(query, ref _id);
        }
Esempio n. 18
0
        private void btnProcurar_Click(object sender, System.EventArgs e)
        {
            Business.BsFields fds    = new Business.BsField(form).GetObjects();
            string            values = "";

            for (int i = 0; i < fds.Count; i++)
            {
                string fields     = "campo" + fds[i].Id + "";
                string returns    = "";
                string returnsAnd = "";

                if (fds[i].TypeObject.Id != 3)
                {
                    returns = Request["txtCampo" + fds[i].Id];
                    if (fds[i].Type.Id == 3 || fds[i].Type.Id == 7 || fds[i].Type.Id == 9)
                    {
                        returnsAnd = Request["txtCampo" + fds[i].Id + "-End"];
                    }
                }
                else
                {
                    BsItensField itsf = new BsItemField(fds[i]).GetObjects();
                    for (int x = 0; x < itsf.Count; x++)
                    {
                        string ret = Request["txtCampo" + fds[i].Id + "-" + x];
                        if (ret != "" && ret != null)
                        {
                            returns += ret + ",&nbsp;";
                        }
                    }

                    if (returns != "")
                    {
                        returns = returns.Substring(0, returns.Length - 7);
                    }
                }

                if (returns == "0")
                {
                    returns = "";
                }
                if (returnsAnd == "0")
                {
                    returnsAnd = "";
                }

                if (fds[i].Type.Id == 3)
                {
                    if (returns != "")
                    {
                        values += " and " + fields + " >= '" + Convert.ToDateTime(returns).ToString("yyyy/MM/dd") + "' ";
                    }
                    if (returnsAnd != "")
                    {
                        values += " and " + fields + " <= '" + Convert.ToDateTime(returnsAnd).ToString("yyyy/MM/dd") + "' ";
                    }
                }
                else if (fds[i].Type.Id == 7)
                {
                    if (returns != "")
                    {
                        values += " and " + fields + " >= " + returns.Replace(".", "").Replace(",", ".") + " ";
                    }
                    if (returnsAnd != "")
                    {
                        values += " and " + fields + " <= " + returnsAnd.Replace(".", "").Replace(",", ".") + " ";
                    }
                }
                else if (fds[i].Type.Id == 9)
                {
                    if (returns != "")
                    {
                        values += " and " + fields + " >= " + returns + " ";
                    }
                    if (returnsAnd != "")
                    {
                        values += " and " + fields + " <= " + returnsAnd + " ";
                    }
                }
                else if (fds[i].Type.Id == 5 || fds[i].TypeObject.Id != 3 || fds[i].TypeObject.Id != 6)
                {
                    values += " and " + fields + " like '%" + returns + "%' ";
                }
                else
                {
                    values += " and " + fields + " = '" + returns + "' ";
                }
            }

            RegisterClientScriptBlock("ok", "<script>top.openItemForm( 'tbChild" + form.Id + "', 'block', '', \"" + values + "\" );top.closeLayerAlpha();</script>");
        }
Esempio n. 19
0
 public BsItemField(BsField field_)
 {
     _field = field_;
 }
Esempio n. 20
0
 public static void AlterPosition(BsField f, int position)
 {
     Database.DaFields.AlterPosition(f.Id, position);
 }