Пример #1
0
        protected void rblType_SelectedIndexChanged(object sender, EventArgs e)
        {
            DateTime date     = DateTime.Now;
            string   strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2);

            if (rblType.SelectedItem.Text == "报价")
            {
                if (SheetNums.IsSheetNumOfOP(strtoday))
                {
                    txtSheetNum.Text = SheetNums.SheetNumOfOP("BJ", strtoday);
                }
                else
                {
                    txtSheetNum.Text = "BJ" + strtoday + "001";
                }
            }
            else if (rblType.SelectedItem.Text == "投标")
            {
                if (SheetNums.IsSheetNumOfOP(strtoday))
                {
                    txtSheetNum.Text = SheetNums.SheetNumOfOP("TB", strtoday);
                }
                else
                {
                    txtSheetNum.Text = "TB" + strtoday + "001";
                }
            }
        }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    EmployeeInfo       em     = (EmployeeInfo)Session["Employee"];
                    MainOfferPriceInfo mainop = new MainOfferPriceInfo();
                    mainop.Save();

                    int            OpId = Convert.ToInt32(Request["OfferPriceId"].ToString());
                    OfferPriceInfo op   = new OfferPriceInfo(OpId);
                    op.MainOfferPriceId = mainop.MainOfferPriceId;

                    if (ddlProject.SelectedValue != "")
                    {
                        op.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue);
                    }
                    if (ddlEmployee.SelectedValue != "")
                    {
                        op.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue);
                    }

                    op.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue);

                    DateTime date     = DateTime.Now;
                    string   strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2);
                    op.Today    = strtoday;
                    op.SheetNum = txtSheetNum.Text.ToString();

                    op.FillTableDate   = Convert.ToDateTime(txtFillTableDate.Text.ToString());
                    op.SectionView     = txtSectionView.Text.ToString();
                    op.SheetNum        = txtSheetNum.Text.ToString();
                    op.ProjectDes      = txtProjectDes.Text.ToString();
                    op.MoneySum        = txtMoneySum.Text.ToString();
                    op.BigMoney        = txtBigMoney.Text.ToString();
                    op.ProductMoneySum = lblMoneySum.Text.ToString();
                    if (UpFile.HasFile == true)
                    {
                        string name        = this.UpFile.FileName;
                        int    startindex  = this.UpFile.FileName.LastIndexOf(@"\") + 1;
                        string fileName    = this.UpFile.FileName.Substring(startindex);
                        string phyFileName = this.Server.MapPath(@"~\Files\" + "OfferPrice") + @"\" + fileName;
                        this.UpFile.SaveAs(phyFileName);

                        OfferFileInfo of = new OfferFileInfo();
                        of.OfferFileName = fileName;                   //文件名
                        of.PhyFileName   = UpFile.PostedFile.FileName; //本地文件路径
                        of.Save();
                        op.OfferFileId = Convert.ToInt32(of.OfferFileId);
                    }

                    op.SendEmployeeName = em.EmployeeName;
                    op.SendEmployeeId   = em.EmployeeId;
                    op.PreIsApply       = 1;
                    op.PreIsOver        = 1;

                    op.IsApply   = 0;
                    op.IsApprove = 0;
                    op.IsApply1  = 0;
                    op.IsApply2  = 0;
                    op.IsOver1   = 0;
                    op.IsOver2   = 0;

                    //GridView嵌套判断
                    op.IsMain      = 1;
                    op.IsMain1     = 1;
                    op.IsMain2     = 1;
                    op.IsMain3     = 1;
                    op.IsNewCreate = 0;
                    op.IsSignName  = 0;
                    op.Save();

                    if (UpFile.HasFile)
                    {
                        ////文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器
                        //string FileSaveUri = @"ftp://192.168.11.70/www/Files/OfferPrice/";
                        ////FTP用户名密码,就是本机的用户名密码
                        //string ftpUser = "******";
                        //string ftpPassWord = "******";
                        //SendFiles(FileSaveUri, ftpUser, ftpPassWord);
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName));
                    }

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>");

                    ViewState["Isbtn"] = "1";
                    txtSheetNum.Text   = SheetNums.SheetNumOfOP("BJTB", strtoday);
                    gvProductInitBind();
                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true);
                }
            }
        }