Ejemplo n.º 1
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            CRM_AttendanceLogGroup newGroup = new CRM_AttendanceLogGroup();

            newGroup.AddedTimeStamp = DateTime.Now;

            if (dcDateOverride.Text != "")
            {
                newGroup.AddedTimeStamp = dcDateOverride.Value;
            }

            int eventID = 0;

            if (int.TryParse(ddlEvents.SelectedValue, out eventID))
            {
                newGroup.CRM_AttendanceEventID = eventID;
            }

            newGroup.DateInserted = UKTime.Now;
            newGroup.OriginType   = (byte)CRM_AttendanceLogGroup.OriginTypes.CRM;

            db.CRM_AttendanceLogGroups.InsertOnSubmit(newGroup);

            foreach (RepeaterItem RI in repTypes.Items)
            {
                int quantity = 0;
                int.TryParse(((HtmlInputText)RI.FindControl("txtQuantity")).Value, out quantity);

                int typeID = 0;
                int.TryParse(((HtmlInputHidden)RI.FindControl("hdn_typeID")).Value, out typeID);



                if (quantity > 0 && typeID != 0)
                {
                    CRM_AttendanceLog newlog = new CRM_AttendanceLog();

                    db.CRM_AttendanceLogs.InsertOnSubmit(newlog);

                    newlog.CRM_AttendanceLogGroup     = newGroup;
                    newlog.CRM_AttendancePersonTypeID = typeID;
                    newlog.Quantity = quantity;
                }
            }

            db.SubmitChanges();

            NoticeManager.SetMessage(newGroup.CRM_AttendanceLogs.Sum(a => a.Quantity).ToString() + " Entries Added");
        }
Ejemplo n.º 2
0
    private void readForm()
    {
        var steps = new List <StepItem>();

        foreach (RepeaterItem RI in StepRep.Items)
        {
            var step = new StepItem();
            step.Name     = ((TextBox)RI.FindControl("NameBox")).Text;
            step.Ratio    = Double.Parse(((TextBox)RI.FindControl("RatioBox")).Text);
            step.SubSteps = new List <SubStepItem>();

            var SubRep = (Repeater)RI.FindControl("SubStepRep");
            foreach (RepeaterItem SubRI in SubRep.Items)
            {
                var subStep = new SubStepItem();
                subStep.Name  = ((TextBox)SubRI.FindControl("SubNameBox")).Text;
                subStep.Ratio = Double.Parse(((TextBox)SubRI.FindControl("SubRatioBox")).Text);
                step.SubSteps.Add(subStep);
            }
            steps.Add(step);
        }
        StoredList = steps;
    }
Ejemplo n.º 3
0
        protected void CreateSql()
        {
            if (txtVName.Value == "")
            {
                lbCheck.InnerHtml = "<font style='color:red'>视图名不允许为空!</font>";
                lbCheck.Visible   = true;
                return;
            }
            if (string.IsNullOrEmpty(Request.QueryString["ViewName"]))
            {
                if (CheckView("ZL_V_" + txtVName.Value) != 0)
                {
                    lbCheck.InnerHtml = "<font style='color:red'>已存在此视图名,请重新命名!</font>";
                    lbCheck.Visible   = true;
                    return;
                }
            }
            lbCheck.Visible = false;
            if (string.IsNullOrEmpty(ListBox1.Text))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请至少选择一个表!');</script>");
                return;
            }
            foreach (RepeaterItem RI in Repeater1.Items)
            {
                if (RI.Visible == true)
                {
                    ListBox         lb = (ListBox)RI.FindControl("ListBox3");
                    HtmlInputHidden tN = (HtmlInputHidden)RI.FindControl("tN");
                    strTName = strTName + tN.Value + ",";
                    string[] checkStr = null;
                    for (int i = 0; i < lb.Items.Count; i++)
                    {
                        if (lb.Items[i].Selected == true)
                        {
                            if (!string.IsNullOrEmpty(strView))
                            {
                                checkStr = strView.Substring(0, strView.Length - 1).Split(',');
                                //Response.Write("<script>alert('"+checkStr.Length.ToString()+"');</script>");
                                foreach (string s in checkStr)
                                {
                                    string s1 = s.Split('.')[1];
                                    //Response.Write("<script>alert('" + s1.ToLower() + "');</script>");
                                    if (lb.Items[i].Text.ToLower() == s1.ToLower())
                                    {
                                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(\"视图或函数中的列名必须唯一,在视图或函数 'ZL_V_" + tN.Value + "' 中多次指定了列名 '" + s1 + "'\");</script>");
                                        return;
                                    }
                                }
                            }
                            strView = strView + tN.Value + "." + lb.Items[i].Text + ",";
                        }
                    }
                }
            }

            if (strView.Trim() == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请至少选择一个要显示的字段!');</script>");
                return;
            }
            strTName = strTName.Substring(0, strTName.Length - 1);
            strView  = strView.Substring(0, strView.Length - 1);
            if (string.IsNullOrEmpty(Request.QueryString["ViewName"]))
            {
                str = "create view " + "ZL_V_" + txtVName.Value.Trim() + " as select " + strView + " from " + strTName;
            }
            else
            {
                str = "alter view " + "ZL_V_" + txtVName.Value.Trim() + " as select " + strView + " from " + strTName;
            }
            if (taWhere.Value.Trim() != "")
            {
                if (!Regex.IsMatch(taWhere.Value.Trim(), @"^\w+\.\w+\s*=\s*\w+\.\w+(\s+[a,A] [n,N][d,D]\s+\w+\.\w+\s*=\s*\w+\.\w+)*$"))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您输入的连接字符串格式有误!');</script>");
                    str = "";
                    return;
                }
                str = str + " where " + taWhere.Value.Trim();
            }
            status = true;
        }
Ejemplo n.º 4
0
        //Entry需要为一个名称空间的控件
        public void GetNearestControl(Control Entry, int nCtrlCount, List <string> lsCtrlIDs, string strCtrlID)
        {
            if (nCtrlCount > 0)
            {
                if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.Repeater"))
                {
                    foreach (RepeaterItem RI in ((Repeater)Entry).Items)
                    {
                        Control wbTemp = (Control)RI.FindControl(lsCtrlIDs[lsCtrlIDs.Count - nCtrlCount]);
                        GetNearestControl(wbTemp, nCtrlCount - 1, lsCtrlIDs, strCtrlID);
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.GridView"))
                {
                    foreach (GridViewRow gvr in ((GridView)Entry).Rows)
                    {
                        Control wbTemp = (Control)gvr.FindControl(lsCtrlIDs[lsCtrlIDs.Count - nCtrlCount]);
                        GetNearestControl(wbTemp, nCtrlCount - 1, lsCtrlIDs, strCtrlID);
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.DataList"))
                {
                    foreach (DataListItem dli in ((DataList)Entry).Items)
                    {
                        Control wbTemp = (Control)dli.FindControl(lsCtrlIDs[lsCtrlIDs.Count - nCtrlCount]);
                        GetNearestControl(wbTemp, nCtrlCount - 1, lsCtrlIDs, strCtrlID);
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.DetailsView"))
                {
                    foreach (DetailsViewRow dvr in ((DetailsView)Entry).Rows)
                    {
                        Control wbTemp = (Control)dvr.FindControl(lsCtrlIDs[lsCtrlIDs.Count - nCtrlCount]);
                        GetNearestControl(wbTemp, nCtrlCount - 1, lsCtrlIDs, strCtrlID);
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.ListView"))
                {
                    foreach (ListViewDataItem lvdi in ((ListView)Entry).Items)
                    {
                        Control wbTemp = (Control)lvdi.FindControl(lsCtrlIDs[lsCtrlIDs.Count - nCtrlCount]);
                        GetNearestControl(wbTemp, nCtrlCount - 1, lsCtrlIDs, strCtrlID);
                    }
                }

                //AjaxControlToolkit.TabContainer
                else if (Entry.GetType().FullName.Equals("AjaxControlToolkit.TabContainer"))
                {
                    string[] ctrlid = lsCtrlIDs.ToArray();
                    if (ctrlid.Length == 2)
                    {
                        Control wbFinal = ((AjaxControlToolkit.TabContainer)Entry).FindControl(ctrlid[1]).FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                    //TabContainer中有YYcontrol
                    else if (ctrlid.Length == 3)
                    {
                        Control con = ((AjaxControlToolkit.TabContainer)Entry).FindControl(ctrlid[1]).FindControl(ctrlid[2]);
                        if (con.GetType().FullName.Equals("YYControls.SmartGridView"))
                        {
                            foreach (GridViewRow gvr in ((YYControls.SmartGridView)con).Rows)
                            {
                                Control wbFinal = (Control)gvr.FindControl(strCtrlID);
                                wbFinal.Visible = false;
                            }
                        }
                        else if (con.GetType().FullName.Equals("System.Web.UI.WebControls.GridView"))
                        {
                            foreach (GridViewRow gvr in ((GridView)con).Rows)
                            {
                                Control wbFinal = (Control)gvr.FindControl(strCtrlID);
                                wbFinal.Visible = false;
                            }
                        }
                    }
                }
                //else if (Entry.GetType().FullName.Equals("YYControls.SmartGridView"))
                //{
                //    string[] ctrlid = lsCtrlIDs.ToArray();

                //    Control wbFinal = ((YYControls.SmartGridView)Entry).FindControl(ctrlid[0]).FindControl(strCtrlID);

                //    wbFinal.Visible = false;
                //}
            }
            else
            {
                //设置最终控件
                if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.Repeater"))
                {
                    foreach (RepeaterItem RI in ((Repeater)Entry).Items)
                    {
                        Control wbFinal = (Control)RI.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.GridView"))
                {
                    foreach (GridViewRow gvr in ((GridView)Entry).Rows)
                    {
                        Control wbFinal = (Control)gvr.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.DataList"))
                {
                    foreach (DataListItem dli in ((DataList)Entry).Items)
                    {
                        Control wbFinal = (Control)dli.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.DetailsView"))
                {
                    foreach (DetailsViewRow dvr in ((DetailsView)Entry).Rows)
                    {
                        Control wbFinal = (Control)dvr.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }
                else if (Entry.GetType().FullName.Equals("System.Web.UI.WebControls.ListView"))
                {
                    foreach (ListViewDataItem lvdi in ((ListView)Entry).Items)
                    {
                        Control wbFinal = (Control)lvdi.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }

                //yycontrol.smartgridview
                else if (Entry.GetType().FullName.Equals("YYControls.SmartGridView"))
                {
                    foreach (GridViewRow gvr in ((YYControls.SmartGridView)Entry).Rows)
                    {
                        Control wbFinal = (Control)gvr.FindControl(strCtrlID);
                        wbFinal.Visible = false;
                    }
                }

                else if (Entry.GetType().FullName.Equals("AjaxControlToolkit.TabContainer"))
                {
                    string[] ctrlid = lsCtrlIDs.ToArray();

                    Control wbFinal = ((AjaxControlToolkit.TabContainer)Entry).FindControl(ctrlid[1]).FindControl(strCtrlID);

                    wbFinal.Visible = false;
                }

                return;
            }
        }