Esempio n. 1
0
        //��������
        protected void btn_Cancle_Click(object sender, EventArgs e)
        {
            LabMS.BLL.ProjectApp Project = new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();

            int ID = 0;
            if (Request.QueryString["ID"] != null)
            {
                if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                {

                    if (HFQueryString != ID)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѯ�ַ�������!');window.location.href=''</script>'");
                        return;
                    }

                    model = Project.GetModel(ID);
                    model.App_State = "SubmitNotYet";
                    try
                    {
                        Project.Update(model);
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript' >alert('��������ɹ�');if(window.confirm('�Ƿ�ص��б�ҳ��')){window.location.href='ApplicationList.aspx'}else{window.location.href = window.location.href;}</script>");
                        return;
                    }
                    catch (Exception ex)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript' >alert('��������ʧ��');if(window.confirm('�Ƿ�ص��б�ҳ��')){window.location.href='ApplicationList.aspx'}else{window.location.href = window.location.href;}</script>");
                        return;
                    }

                }
            }
        }
Esempio n. 2
0
        protected void AttachItemDataBind()
        {
            LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp applicationmodel = new LabMS.Model.ProjectApp();

            LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
            List<LabMS.Model.AttachmentItem> ls = new List<LabMS.Model.AttachmentItem>();

            if (QueryString != 0)
            {
                applicationmodel = Application.GetModel(QueryString);
                int Attach_ID = 0;
                if (applicationmodel.App_Attachment != null)
                {
                    Attach_ID = applicationmodel.App_Attachment.Value;

                    ls = AttachItem.GetModelList("Item_Type ='1' and Attach_ID=" + Attach_ID);

                    if (ls.Count != 0)
                    {
                        string strHTML = "<table>";
                        for (int i = 0; i < ls.Count; i++)
                        {
                            strHTML += "<tr>";
                            strHTML += "<td style='display:none;'>";
                            strHTML += ls[i].ID;
                            strHTML += "</td>";
                            strHTML += "<td>";
                            strHTML += "<a>";
                            strHTML += "ɾ��";
                            strHTML += "</a>";
                            strHTML += "</td>";
                            strHTML += "<td>";
                            strHTML += ls[i].Item_Name;
                            strHTML += "</td>";
                            strHTML += "</tr>";
                        }
                        strHTML += "</table>";
                        itemlist.Value = strHTML;
                    }
                }
            }
        }
Esempio n. 3
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            #region
            int temp = 0;
            decimal tempde = 0.0M;
            int Index = 0;
            int.TryParse(tb_EIndex.Value, out Index);
            for (int i = 0; i < Index; i++)
            {
                if (!string.IsNullOrEmpty(Request.Form["code" + i + ""])&&!string.IsNullOrEmpty(Request.Form["name"+i]))
                {
                    if (string.IsNullOrEmpty(Request.Form["num" + i + ""]))
                    {
                        LabMS.Common.JShelper.JSAlert(Page, "err", "������������������!");
                        return;
                    }
                    else
                    {
                        if (!int.TryParse(Request.Form["num" + i + ""], out temp))
                        {
                            LabMS.Common.JShelper.JSAlert(Page, "err", "������������������������!");
                            return;
                        }
                    }

                    if (string.IsNullOrEmpty(Request.Form["unitprice" + i]))
                    {
                        LabMS.Common.JShelper.JSAlert(Page, "err", "�����������۲���Ϊ��!");
                        return;
                    }
                    else
                    {
                        if (!decimal.TryParse(Request.Form["unitprice" + i], out tempde))
                        {
                            LabMS.Common.JShelper.JSAlert(this, "err", "���������ĵ���ֻ��Ϊ����!");
                            return;
                        }
                    }

                    if (string.IsNullOrEmpty(Request.Form["model" + i]))
                    {
                        LabMS.Common.JShelper.JSAlert(this, "err", "�����������ͺŲ���Ϊ��");
                        return;
                    }

                }

            }

            #endregion
            LabMS.BLL.ProjectApp App = new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();
            model = App.GetModel(QueryString);
            try
            {
                model.App_ApplyFinancing = Convert.ToInt32(tb_ApplyFinancing.Text);
            }
            catch
            {
                LabMS.Common.JShelper.JSAlert(this, "�������Ϊ����", "ȷ������Ľ��Ϊ����");
                return;
            }

            #region �����޸�

            model.App_InCharge = tb_InCharge.Text;
            model.App_Phone = tb_Phone.Text;
            model.App_Code = tb_Name.Text;
            model.App_ProjectCode = tb_Code.Text;
            int Temp=0;
            if (int.TryParse(ddl_Lab.SelectedValue, out Temp))
            {
                if (Temp > 0)
                {
                    model.LabID = Temp;
                }
            }
            model.App_Location = tb_Loction.Text;
            model.App_Necessity = tb_Necessity.Text;
            model.App_InstallCondition = tb_InstallCondition.Text;
            model.App_Positions = tb_PositionCode.Value.Trim();
            model.App_LabType = ddl_LabType.SelectedValue;
            model.App_ConstructionType = ddl_ConType.SelectedValue;
            if (int.TryParse(tb_ApplyFinancing.Text, out Temp))
            {
                if (Temp > 0)
                {
                    model.App_ApplyFinancing = Temp;
                }
            }
            model.App_Necessity = tb_Necessity.Text;

            ///ʱ�����
            string[] DateTimeList = {
                                        "yyyy/M/d tt hh:mm:ss",
                                        "yyyy/MM/dd tt hh:mm:ss",
                                        "yyyy/MM/dd HH:mm:ss",
                                        "yyyy/M/d HH:mm:ss",
                                        "yyyy/MM/dd",
                                        "yyyy-MM-dd hh:mm:ss",
                                        "yyyy-MM-dd",
                                        "yyyy-M-d"
                                     };
            try
            {
                DateTime AppTime = DateTime.ParseExact(tb_AppTime.Text, DateTimeList, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AllowInnerWhite);
                DateTime CompleteTime = DateTime.ParseExact(tb_CompletionTime.Text, DateTimeList, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AllowInnerWhite);
                if (DateTime.Compare(AppTime, CompleteTime) < 0)
                {
                    model.App_AppTime = AppTime;
                    model.App_CompletionTime = CompleteTime;
                }
                else
                {
                    LabMS.Common.JShelper.JSAlert(this, "����ʱ��Ĵ�С�д���", "����ʱ��Ĵ�С�д������С������������");
                    return;
                }

            }
            catch
            {
                  LabMS.Common.JShelper.JSAlert(this,"ʱ���ʽ����","ʱ���С�������ʱ���ʽ������ȷ�Ϻ�����д");
                  return;

            }

            try
            {
                App.Update(model);
            }
            catch(Exception ex)
            {

                lb_Error.Text = ex.Message;
            }

            LabMS.BLL.ConsumeApp ConsumeApp = new LabMS.BLL.ConsumeApp();
            List<LabMS.Model.ConsumeApp> lsConsumeApp = new List<LabMS.Model.ConsumeApp>();
            lsConsumeApp = ConsumeApp.GetModelList("AppID=" + model.ID);
            try
            {
                for (int n = 0; n < lsConsumeApp.Count; n++)
                {
                    ConsumeApp.Delete(lsConsumeApp[n].ID);
                }
            }
            catch(Exception ex)
            {
                LabMS.Common.JShelper.JSAlert(this,"header",ex.Message);
                return;
            }

            LabMS.Model.ConsumeApp consumeappmodel;
            for (int i = 0; i < Index; i++)
            {
                consumeappmodel = new LabMS.Model.ConsumeApp();

                int nums=0;
                decimal unitprice = new decimal();

                try
                {
                    if (Request.Form["code" + i] != null)
                    {
                        consumeappmodel.EquipType = Request.Form["code" + i];
                        consumeappmodel.EquipName = Request.Form["name" + i];
                        consumeappmodel.Model = Request.Form["model" + i];
                        consumeappmodel.Factory = Request.Form["factory" + i];
                        consumeappmodel.Argument = Request.Form["argument" + i];
                        decimal.TryParse(Request.Form["unitprice" + i], out unitprice);
                        consumeappmodel.UnitPrice = unitprice;
                        int.TryParse(Request.Form["num" + i], out nums);
                        consumeappmodel.EquipNum = nums;
                        consumeappmodel.AppID = model.ID;
                        ConsumeApp.Add(consumeappmodel);
                    }

                }
                catch (Exception ex)
                {
                    LabMS.Common.JShelper.JSAlert(this, "header", ex.Message);
                    return;
                }

            }

            if (!SaveItem(model))
            {
                lb_Error.Text = "�����ļ�ʱ����";
            }

            #endregion �����޸�
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�޸ijɹ���');window.location='AppPreview.aspx" + "?ID=" + QueryString.ToString() + "';</script>");
        }
Esempio n. 4
0
        protected void DataBinds()
        {
            int QueryID = 0;
            if (int.TryParse(Request.QueryString["ID"], out QueryID))
            {
                if (QueryID <= 0 || QueryID != HF_QueryString)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>window.location.href='err.aspx?Message=��ѯ�ַ�������'</script>'");
                    return;
                }
            }
            #region  Tranitional Region

            LabMS.BLL.ProjectApp App=new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();

            model = App.GetModel(QueryString);

            //ʵ����
            LabMS.BLL.Lab Lab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> lsLab = new List<LabMS.Model.Lab>();
            lsLab = Lab.GetModelList("");
            if (lsLab.Count != 0)
            {
                ddl_Lab.DataSource = lsLab;
                ddl_Lab.DataTextField = "Lab_Name";
                ddl_Lab.DataValueField = "ID";
                ddl_Lab.DataBind();
                if (model.LabID != null)
                {
                    ddl_Lab.Items.FindByValue(model.LabID.ToString()).Selected = true;
                }
            }

            LabMS.BLL.DictionaryClass DicClass = new LabMS.BLL.DictionaryClass();
            LabMS.Model.DictionaryClass ds = new LabMS.Model.DictionaryClass();
            LabMS.BLL.Dictionary Dic = new LabMS.BLL.Dictionary();
            List<LabMS.Model.Dictionary> lsDic = new List<LabMS.Model.Dictionary>();

            if (DicClass.GetModelList("Code='App_LabType'").Count != 0)
            {
                ds = DicClass.GetModelList("Code='App_LabType'")[0];
                lsDic = Dic.GetModelList("DClass='" + ds.Code + "'");
                if (lsDic.Count != 0)
                {
                    ddl_LabType.DataSource = lsDic;
                    ddl_LabType.DataTextField = "Name";
                    ddl_LabType.DataValueField = "Code";
                    ddl_LabType.DataBind();
                    if (!string.IsNullOrEmpty(model.App_LabType))
                    {
                        ddl_LabType.Items.FindByValue(model.App_LabType).Selected = true;
                    }
                }
            }

            if (DicClass.GetModelList("Code='App_ConstructionType'").Count != 0)
            {
                ds = DicClass.GetModelList("Code='App_ConstructionType'")[0];
                lsDic = Dic.GetModelList("DClass='" + ds.Code + "'");
                if (lsDic.Count != 0)
                {
                    ddl_ConType.DataSource = lsDic;
                    ddl_ConType.DataTextField = "Name";
                    ddl_ConType.DataValueField = "Code";
                    ddl_ConType.DataBind();
                    if (!string.IsNullOrEmpty(model.App_ConstructionType))
                    {
                        ddl_ConType.Items.FindByValue(model.App_ConstructionType).Selected = true;
                    }
                }
            }

            if (model.App_Positions != "")
            {
                lsDic = Dic.GetModelList("Code='" + model.App_Positions.Trim() + "'");

                if (lsDic.Count == 1)
                {
                    tb_Position.Text = lsDic[0].Name;
                    tb_PositionCode.Value = lsDic[0].Code;
                }
            }
            if (model.App_AppTime != null)
            {
                tb_AppTime.Text = model.App_AppTime.Value.ToShortDateString();
            }
            if (model.App_CompletionTime != null)
            {
                tb_CompletionTime.Text = model.App_CompletionTime.Value.ToShortDateString();
            }
            tb_InCharge.Text = model.App_InCharge;
            tb_Phone.Text = model.App_Phone;
            tb_Name.Text = model.App_Code;
            tb_Code.Text = model.App_ProjectCode;
            tb_Loction.Text = model.App_Location;
            tb_InstallCondition.Text = model.App_InstallCondition;
            tb_Necessity.Text = model.App_Necessity;
            tb_ApplyFinancing.Text = model.App_ApplyFinancing.ToString();

            lsDic = Dic.GetModelList("DClass='App_State'");
            foreach (LabMS.Model.Dictionary var in lsDic)
            {
                if (model.App_State == var.Code)
                {
                    lb_State.Text = var.Name;
                }
            }
            #endregion Tranitional

            BindConsume();
        }
Esempio n. 5
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (hf_QueryString.Value != QueryString.ToString() || QueryString <= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>window.location.href='~/err.aspx?Message=��ѯ�ַ�������';</script>");
                return;
            }

            if (QueryString != 0)
            {
                LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
                LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();
                model = Application.GetModel(QueryString);

                if (ddl_Conclusion.SelectedValue.Trim() == "0")
                {
                    LabMS.Common.JShelper.JSAlert(this, "�������", "��ѡ����֤����");
                    return;
                }

                if (ddl_Conclusion.SelectedValue == "Approve")
                {
                    int num = 0;
                    if (!int.TryParse(tb_ApproveFinancing.Text, out num))
                    {
                        LabMS.Common.JShelper.JSAlert(this, "�������", "������Ӧ��Ϊ����");
                        return;
                    }
                    else
                    {
                        model.App_ApproveFinancing = Convert.ToInt32(tb_ApproveFinancing.Text);
                    }
                }

                if (tb_AppView.Text.Length > 50)
                {
                    LabMS.Common.JShelper.JSAlert(this, "�������", "�����ַ���ӦС��50");
                    return;
                }

                model.App_ArgumentView = tb_AppView.Text;
                model.App_ArgumentConclusion = ddl_Conclusion.SelectedValue;

                switch (ddl_Conclusion.SelectedValue.Trim())
                {
                    case "Approve":
                        model.App_State = "Approved";
                        break;
                    case "Delay":
                        model.App_State = "Submitted";
                        break;
                    case "Rejected":
                        model.App_State = "Rejected";
                        break;
                }

                Application.Update(model);

                Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('���ύ��֤���ۣ�');window.location.href=window.location.href;</script>");
                return;

            }
        }
Esempio n. 6
0
        protected void Gv_FileList_DataBinds()
        {
            if (HF_QueryString != QueryString || QueryString <= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>window.location.href='~/err.aspx?Message=��ѯ�ַ�������';</script>");
                return;
            }

            if (QueryString != 0)
            {
                LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
                LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();
                model = Application.GetModel(QueryString);
                if (model.App_Attachment != null || model.App_Attachment != 0)
                {
                    LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
                    List<LabMS.Model.AttachmentItem> ls = new List<LabMS.Model.AttachmentItem>();
                    if (model.App_Attachment != null)
                    {
                        ls = AttachItem.GetModelList("Attach_ID=" + model.App_Attachment.Value + " and Item_Type=1");

                    }
                    Gv_FileList.DataSource = ls;
                    Gv_FileList.DataBind();

                }
            }
            else
            {
                lb_Error.Text = "��ѯ�ַ�������";
            }
        }
Esempio n. 7
0
        protected void Gv_FileList_DataBinds()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                int ID = 0;
                int AttachID=0;
                if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                {
                    if (ID != 0)
                    {
                        if (HFQueryString != ID)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>window.location.href='err.aspx?Message=��ѯ�ַ�������'</script>'");
                            return;
                        }
                        LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
                        LabMS.Model.ProjectApp applicationmodel = new LabMS.Model.ProjectApp();
                        applicationmodel = Application.GetModel(ID);

                        LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
                        List<LabMS.Model.AttachmentItem> ls = new List<LabMS.Model.AttachmentItem>();
                        if (applicationmodel.App_Attachment != null)
                        {
                            AttachID = applicationmodel.App_Attachment.Value;
                            if (AttachID != 0)
                            {
                                ls = AttachItem.GetModelList("Attach_ID=" + AttachID.ToString());
                            }
                        }
                        //if (ls.Count != 0)
                        //{
                        //    for (int n = 0; n < ls.Count; n++)
                        //    {
                        //        ls[n].Item_Name = ls[n].Item_Name.Substring(0,ls[n].Item_Name.LastIndexOf("_"));
                        //    }
                        //}

                        Gv_FileList.DataSource = ls;
                        Gv_FileList.DataBind();
                    }
                }
            }
        }
Esempio n. 8
0
        protected void AttachItemDataBind()
        {
            if (QueryString != HF_QueryString || QueryString <= 0 || HF_QueryString <= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript>window.location.href='err.aspx?Message=��ѯ�ַ�������'</script>");
                return;
            }

            LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp applicationmodel = new LabMS.Model.ProjectApp();

            LabMS.BLL.Attachment Attach = new LabMS.BLL.Attachment();
            LabMS.Model.Attachment attachmodel = new LabMS.Model.Attachment();

            LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
            List<LabMS.Model.AttachmentItem> ls = new List<LabMS.Model.AttachmentItem>();

            if (QueryString != 0)
            {
                applicationmodel = Application.GetModel(QueryString);
                int AttachID = 0;
                if (applicationmodel.App_Attachment != null)
                {
                    AttachID = applicationmodel.App_Attachment.Value;

                    ls = AttachItem.GetModelList("Item_Type ='2' and Attach_ID=" + AttachID);

                    if (ls.Count != 0)
                    {
                        tb_ID.Value = AttachID.ToString();

                    }
                    else
                    {
                        btn_download.Attributes.Add("style", "display:none");
                    }
                    if (ls.Count != 0)
                    {
                        string strHTML = "<table>";
                        for (int i = 0; i < ls.Count; i++)
                        {
                            strHTML += "<tr>";
                            strHTML += "<td style='display:none;'>";
                            strHTML += ls[i].ID;
                            strHTML += "</td>";
                            strHTML += "<td>";
                            strHTML += "<a>";
                            strHTML += "ɾ��";
                            strHTML += "</a>";
                            strHTML += "</td>";
                            strHTML += "<td>";
                            strHTML += ls[i].Item_Name;
                            strHTML += "</td>";
                            strHTML += "</tr>";
                        }
                        strHTML += "</table>";
                        itemlist.Value = strHTML;
                    }
                }

            }
            else
            {
                Submit.Visible = false;
                lb_Error.Text = "ϵͳ�쳣����ѯ�ַ����쳣";
                lb_Error.Visible = true;
            }
        }
Esempio n. 9
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(itemIDs.Value))
            {
                string[] array1 = itemIDs.Value.Split(',');
                for (int m = 0; m < array1.Length; m++)
                {
                    if (array1[m] != "0"||array1[m]!="")
                    {
                        LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
                        AttachItem.Delete(Convert.ToInt32(array1[m]));
                    }
                }
            }
            int attachID = 0;
            if ((HttpContext.Current.Request.Files.Count - 1) > 0)
            {
                bool Result = false;
                try
                {
                    LabMS.BLL.ProjectApp Application = new LabMS.BLL.ProjectApp();
                    LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();
                    model = Application.GetModel(QueryString);
                    if (model.App_Attachment == null)
                    {
                        attachID = 0;
                    }
                    else
                    {
                        attachID = model.App_Attachment.Value;
                    }

                    int count = HttpContext.Current.Request.Files.Count;
                    HttpFileCollection Files = HttpContext.Current.Request.Files;
                    string savePath = HttpContext.Current.Request.MapPath(@"../Content/UpLoadFile/");
                    List<string> fileNames = LabMS.Common.FileUpload.SaveFiles(Files, savePath);

                    if (attachID == 0)
                    {
                        LabMS.BLL.Attachment Attach = new LabMS.BLL.Attachment();
                        LabMS.Model.Attachment attachmodel = new LabMS.Model.Attachment();
                        attachID = Attach.Add(attachmodel);
                        model.App_Attachment = attachID;

                    }

                    LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
                    LabMS.Model.AttachmentItem itemmodel;

                    for (int n = 0; n < fileNames.Count; n++)
                    {
                        if (fileNames[n].Trim() != "")
                        {
                            itemmodel = new LabMS.Model.AttachmentItem();
                            itemmodel.Item_Address = "Content/UpLoadFile/" + fileNames[n].Trim();
                            itemmodel.Item_Name = fileNames[n].Substring(0, fileNames[n].LastIndexOf("_"));
                            itemmodel.Attach_ID = attachID;
                            itemmodel.Item_Type = "2";
                            AttachItem.Add(itemmodel);
                        }
                    }
                    Result = true;

                    Application.Update(model);
                }
                catch
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�ϴ��ļ�ʱ��������ϵ����Ա��');window.location.href=window.location.href; </script>");
                    return;
                }

                if (Result)
                {
                    Build.Visible = true;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('û�������飬��ѡ����������ϴ���'); </script>");
                return;
            }
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>if(window.confirm('���������ɹ����Ƿ񷵻��б�')){ window.location.href='AppTaskList.aspx';}else{window.location.href=window.location.href;}</script>");
            return;
        }
Esempio n. 10
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            #region Validation

            if (string.IsNullOrEmpty(App_ProjectCode.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "����д��Ŀ���");
                return;
            }
            if (string.IsNullOrEmpty(App_Code.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "����д��Ŀ����");
                return;
            }
            if (App_LabName.SelectedValue.Trim() == "0")
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "ѡ��ʵ���Ҳ���Ϊ��");
                return;
            }
            if (App_LabType.SelectedValue == "0")
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "��Ŀ��ʵ�������Ͳ���Ϊ��");
                return;
            }
            if (App_ConstructionType.SelectedValue == "0")
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "��Ŀ�Ľ������Ͳ���Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(App_AppTime.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "����ӵ�����ʱ�䲻��Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(App_CompletionTime.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "����ӵ����ʱ�䲻��Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(App_InCharge.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "��Ŀ�����˲���Ϊ��");
                return;
            }
            else
            {
                if (System.Text.Encoding.Default.GetByteCount(App_InCharge.Text) > 50 )
                {
                    LabMS.Common.JShelper.JSAlert(this, "�������ݳ��ȴ���", "��Ŀ�������������Ȳ�����25�����֣�50��Ӣ���ַ�");
                }
            }

            if (string.IsNullOrEmpty(App_Phone.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "�������ݴ���", "��ϵ�绰����Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(App_ApplyFinancing.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "��Ҫ��������", "����д�������ʽ���Ϊ��");
                return;
            }

            if (HttpContext.Current.Request.Files.Count - 1 <= 0)
            {
                LabMS.Common.JShelper.JSAlert(this, "��Ҫ������", "���ϴ������鸽��");
            }

            int Index = int.Parse(tb_EIndex.Value);
            decimal tempde=0.0M;
            int temp=0;
            for (int i = 0; i < Index; i++)
            {
                if (!string.IsNullOrEmpty(Request.Form["code" + i+""]) && !string.IsNullOrEmpty(Request.Form["name" + i+""]))
                {
                    if (string.IsNullOrEmpty(Request.Form["num" + i]))
                    {
                        LabMS.Common.JShelper.JSAlert(this, "error", "���������������ܿ�");
                        return;
                    }
                    else
                    {
                        if (!int.TryParse(Request.Form["num" + i], out temp))
                        {
                            LabMS.Common.JShelper.JSAlert(this, "error", "��������������������");
                            return;
                        }
                    }
                    if (string.IsNullOrEmpty(Request.Form["unitprice" + i]))
                    {
                        LabMS.Common.JShelper.JSAlert(this, "error", "�����������۲���Ϊ�գ�Ӧ��Ϊ������С��");
                        return;
                    }
                    else
                    {
                        if (!decimal.TryParse(Request.Form["unitprice" + i], out tempde))
                        {
                            LabMS.Common.JShelper.JSAlert(this, "error", "������������Ӧ��Ϊ������С����");
                            return;
                        }
                    }

                }
            }

            #endregion Validation

            LabMS.BLL.ProjectApp ProjectApp = new LabMS.BLL.ProjectApp();
            LabMS.Model.ProjectApp model = new LabMS.Model.ProjectApp();
            model.App_Code = App_Code.Text;
            string[] DateTimeList = {
                                        "yyyy/M/d tt hh:mm:ss",
                                        "yyyy/MM/dd tt hh:mm:ss",
                                        "yyyy/MM/dd HH:mm:ss",
                                        "yyyy/M/d HH:mm:ss",
                                        "yyyy/MM/dd",
                                        "yyyy-MM-dd hh:mm:ss",
                                        "yyyy-MM-dd",
                                        "yyyy-M-d"
                                     };
            try
            {
                DateTime AppTime = DateTime.ParseExact(App_AppTime.Text, DateTimeList, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AllowInnerWhite);
                DateTime CompleteTime=DateTime.ParseExact(App_CompletionTime.Text, DateTimeList, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AllowInnerWhite);
                if (DateTime.Compare(AppTime, CompleteTime) <= 0)
                {
                    model.App_AppTime = AppTime;
                    model.App_CompletionTime = CompleteTime;
                }
                else
                {
                    LabMS.Common.JShelper.JSAlert(this, "����ʱ���С����", "����ϸ�˶ԣ������ʱ��ʹ�С");
                    return;
                }

            }
            catch
            {

                LabMS.Common.JShelper.JSAlert(this, "����ʱ���ʽ����", "����ʱ���ʽ��������������");
                return;
            }

            model.App_InCharge = App_InCharge.Text;
            model.App_Phone = App_Phone.Text;
            model.App_Location = App_Loction.Text.TrimEnd();
            model.App_InstallCondition = App_InstallCondition.Text.TrimEnd();
            model.App_Necessity = App_Necessity.Text.TrimEnd();
            model.App_LabType = App_LabType.SelectedValue;
            model.App_ConstructionType = App_ConstructionType.SelectedValue;
            model.App_State = "SubmitNotYet";

            model.LabID = Convert.ToInt32(App_LabName.SelectedValue.Trim());

            model.App_Positions = tb_PositonCode.Text.Trim();

            model.App_ApplyFinancing = Convert.ToInt32(App_ApplyFinancing.Text);
            model.App_ProjectCode = App_ProjectCode.Text.Trim();

            int attachID=0;
            bool saved = false;
            if ((HttpContext.Current.Request.Files.Count-1)>0)
            {
                try
                {
                    int count = HttpContext.Current.Request.Files.Count;
                    HttpFileCollection Files = HttpContext.Current.Request.Files;
                    string savePath = HttpContext.Current.Request.MapPath(@"../Content/UpLoadFile/");

                    List<string> fileNames = LabMS.Common.FileUpload.SaveFiles(Files, savePath);

                    LabMS.Model.Attachment attachmodel = new LabMS.Model.Attachment();

                    LabMS.BLL.Attachment Attach = new LabMS.BLL.Attachment();
                    attachID = Attach.Add(attachmodel);

                    if (attachID != 0)
                    {
                        LabMS.BLL.AttachmentItem AttachItem = new LabMS.BLL.AttachmentItem();
                        LabMS.Model.AttachmentItem itemmodel;

                        for (int n = 0; n < fileNames.Count; n++)
                        {
                            if (fileNames[n].Trim() != "")
                            {
                                itemmodel = new LabMS.Model.AttachmentItem();
                                itemmodel.Item_Address = "Content/UpLoadFile/"+fileNames[n].Trim();
                                int index = fileNames[n].LastIndexOf("_");
                                itemmodel.Item_Name = fileNames[n].Substring(0, fileNames[n].LastIndexOf("_"));
                                itemmodel.Attach_ID = attachID;
                                itemmodel.Item_Type = "1";
                                AttachItem.Add(itemmodel);
                            }
                        }
                    }
                    saved = true;
                }
                catch
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�ϴ��ļ�ʱ��������ϵ����Ա��');window.location.href='ApplicationList.aspx'; </script>");
                    return;
                }

            }

            if (saved)
            {
                model.App_Attachment = attachID;
            }
            int appid = ProjectApp.Add(model);

            LabMS.Model.ConsumeApp consumeappmodel;
            LabMS.BLL.ConsumeApp ConsumeApp = new LabMS.BLL.ConsumeApp();
            for (int i = 0; i < Index; i++)
            {
                consumeappmodel = new LabMS.Model.ConsumeApp();

                int nums = 0;
                decimal unitprice = new decimal();

                try
                {
                    if (!string.IsNullOrEmpty(Request.Form["code" + i.ToString()+""]) )
                    {
                        consumeappmodel.EquipType = Request.Form["code" + i];
                        consumeappmodel.EquipName = Request.Form["name" + i];
                        consumeappmodel.Model = Request.Form["model" + i];
                        consumeappmodel.Factory = Request.Form["factory" + i];
                        consumeappmodel.Argument = Request.Form["argument" + i];
                        decimal.TryParse(Request.Form["unitprice" + i], out unitprice);
                        consumeappmodel.UnitPrice = unitprice;
                        int.TryParse(Request.Form["num" + i], out nums);
                        consumeappmodel.EquipNum = nums;
                        consumeappmodel.AppID = appid;
                        ConsumeApp.Add(consumeappmodel);
                    }

                }
                catch (Exception ex)
                {
                    LabMS.Common.JShelper.JSAlert(this, "header", ex.Message);
                    return;
                }

            }

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��������Ŀ�б�ҳ�棡');window.location.href='ApplicationList.aspx'; </script>");
            return;
        }