Beispiel #1
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);
        }
Beispiel #2
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>");
        }