示例#1
0
        /// <summary>
        /// 得到一个实体对象
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static Model.ContractApplication GetModel(string id)
        {
            string strSql = "select * from ContractApplication where ID='" + id + "' ";

            Model.ContractApplication model = new Model.ContractApplication();
            DataSet ds = DBHelperSQL.GetDataSet(strSql, connectionString);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ID              = Convert.ToString(ds.Tables[0].Rows[0]["ID"]);
                model.UserName        = Convert.ToString(ds.Tables[0].Rows[0]["UserName"]);
                model.Contacts        = Convert.ToString(ds.Tables[0].Rows[0]["Contacts"]);
                model.Phone           = Convert.ToString(ds.Tables[0].Rows[0]["Phone"]);
                model.Address         = Convert.ToString(ds.Tables[0].Rows[0]["Address"]);
                model.ContractFile    = Convert.ToString(ds.Tables[0].Rows[0]["ContractFile"]);
                model.Type            = Convert.ToString(ds.Tables[0].Rows[0]["Type"]);
                model.Price           = Convert.ToString(ds.Tables[0].Rows[0]["Price"]);
                model.ApplicationTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["ApplicationTime"]);
                model.Remark          = Convert.ToString(ds.Tables[0].Rows[0]["Remark"]);



                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    string fullPathUrl = Server.MapPath(aaPh);//获取下载文件的路劲
            //    System.IO.FileInfo file = new System.IO.FileInfo(fullPathUrl);
            //    if (file.Exists)//判断文件是否存在
            //    {
            //        Response.Clear();
            //        Response.ClearHeaders();
            //        Response.Buffer = false;
            //        Response.AddHeader("content-disposition", "attachment;filename=" + file.Name);
            //        Response.AddHeader("cintent_length", "attachment;filename=" + HttpUtility.UrlDecode(file.Name));
            //        Response.AddHeader("cintent_length", file.Length.ToString());
            //        Response.ContentType = "application/octet-stream";
            //        Response.WriteFile(file.FullName);//通过response对象,执行下载操作
            //        Response.Flush();
            //        Response.End();


            //    }
            //    else
            //    {
            //        ScriptManager.RegisterStartupScript(this, this.GetType(), "dd", "alert('文件不存在')", true);
            //    }
            //}
            //catch
            //{
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "dd", "alert('下载成功')", true);
            //}


            Model.ContractApplication contractApplication = new Model.ContractApplication();
            Model.InvoiceList         invoiceList         = DAL.InvoiceList.GetModel(Convert.ToInt32(Session["id"]));
            invoiceList.ContractStatus = 4;
            DAL.InvoiceList.Update(invoiceList);
            string num = cs.VerifyCodeHelper.Number(4, true);

            contractApplication.ID = invoiceList.UserName + DateTime.Now.Year + "0" + DateTime.Now.Month + num;

            contractApplication.UserName = invoiceList.UserName;
            string id = contractApplication.ID;

            contractApplication.Address  = this.address.Value;
            contractApplication.Contacts = this.contacts.Value;
            contractApplication.Phone    = this.phone.Value;
            contractApplication.Price    = invoiceList.Price;
            contractApplication.Type     = "0";
            string aaPh = "/upload/Invoice/合同.docx";

            // System.IO.FileInfo file = new System.IO.FileInfo(aaPh);
            //contractApplication.ContractFile = file;
            contractApplication.ContractFile = aaPh;
            DAL.ContractApplication.Add(contractApplication);
            Response.Redirect("EndContract.aspx?ID=" + id + "");
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserName"] == null || Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) < 0 || Convert.ToInt32(Session["UserType"]) > 5)
            {
                Response.Write("<script>alert(\"请登录\");location.href = location.origin+\"/forms/publicforms/Login/Login.aspx\";</script>");
                Response.End();
            }
            if (Request["action"] != null && Request["action"] == "GetData")
            {
                if (!Get_invoice())
                {
                    Response.Write("0");
                }
            }

            if (Request["action"] != null && Request["action"] == "DeleteCors")
            {
                DeleteCors();
            }
            if (Request["invoiceListId"] != null)
            {
                string            invoiceListID = Request["invoiceListID"].ToString();
                Model.InvoiceList invoiceList   = DAL.InvoiceList.GetModel(Convert.ToInt32(Request["invoiceListID"]));
                invoiceList.ContractStatus = 2;
                DAL.InvoiceList.Update(invoiceList);
                Response.Write("success");
                Response.End();
            }
            if (Request["action"] != null && Request["action"] == "downloadfile")
            {
                string ID = Request["id"].ToString();
                Model.ContractApplication contract = DAL.ContractApplication.GetModel(ID);
                if (contract.UserName != Session["UserName"].ToString())
                {
                    Response.End();
                }
                else
                {
                    //string fileName = invoiceList.InvoiceFile;//客户端保存的文件名
                    //string filePath = Server.MapPath("DownLoad/aaa.txt");//路径
                    string   filePath = this.Server.MapPath(contract.ContractFile);//文件路径,可用相对路径
                    FileInfo fileInfo = new FileInfo(filePath);
                    Response.Clear();
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()));
                    Response.AddHeader("Content-Length", fileInfo.Length.ToString());
                    Response.AddHeader("Content-Transfer-Encoding", "binary");
                    Response.ContentType     = "application/octet-stream";
                    Response.ContentEncoding = System.Text.Encoding.Default;
                    Response.WriteFile(fileInfo.FullName);
                    Response.Flush();
                    Response.End();
                }
            }
        }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["ID"] != "" && Request["ID"] != null)
     {
         Session["id"] = Request.QueryString["ID"].ToString();
         Model.ContractApplication contractApplication = DAL.ContractApplication.GetModel(Session["id"].ToString());
         ContractId.Text = contractApplication.ID;
     }
     if (Request["action"] != null && Request["action"] == "DownloadAll")
     {
         DownloadAll();
     }
 }
示例#5
0
        public static bool Update1(Model.ContractApplication model)
        {
            string       strSql          = "update ContractApplication set UserName=@UserName, Contacts=@Contacts, Phone=@Phone, Address=@Address, ContractFile=@ContractFile,Type=@Type,Price=@Price,ApplicationTime=@ApplicationTime,Remark=@Remark where ID = '" + model.ID.Trim().ToString() + "'";
            SqlParameter UserName        = new SqlParameter("UserName", SqlDbType.NVarChar); UserName.Value = model.UserName;
            SqlParameter Contacts        = new SqlParameter("Contacts", SqlDbType.NVarChar); Contacts.Value = model.Contacts;
            SqlParameter Phone           = new SqlParameter("Phone", SqlDbType.NVarChar); Phone.Value = model.Phone;
            SqlParameter Address         = new SqlParameter("Address", SqlDbType.NVarChar); Address.Value = model.Address;
            SqlParameter ContractFile    = new SqlParameter("ContractFile", SqlDbType.NVarChar); ContractFile.Value = model.ContractFile;
            SqlParameter Type            = new SqlParameter("Type", SqlDbType.NVarChar); Type.Value = model.Type;
            SqlParameter Price           = new SqlParameter("Price", SqlDbType.NVarChar); Price.Value = model.Price;
            SqlParameter ApplicationTime = new SqlParameter("ApplicationTime", SqlDbType.NVarChar); ApplicationTime.Value = model.ApplicationTime;
            SqlParameter Remark          = new SqlParameter("Remark", SqlDbType.NVarChar); Remark.Value = model.Remark;

            return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { UserName, Contacts, Phone, Address, ContractFile, Type, Price, ApplicationTime, Remark }, connectionString) == 1 ? true : false);
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Num.Value = Request.QueryString["id"].ToString();

                Session["ContractID"] = Request.QueryString["id"].ToString();

                Model.ContractApplication contractApplication = DAL.ContractApplication.GetModel(Session["ContractID"].ToString());
                phone.Value = contractApplication.Phone;
                string SMS = "http://39.108.107.73:8090/sysmonitor/services/monitor/sendmessage.json?key=is8ji3&phone=@phone&message=@message";
                Session["num"] = cs.VerifyCodeHelper.Number(4, true);
                string message = "您的短信验证码为:" + Session["num"] + ",用于正式合同转换,为保证信息安全,请勿将验证码告知他人";

                SMS = SMS.Replace("@message", message);
                SMS = SMS.Replace("@phone", contractApplication.Phone);

                if (cs.HttpHelper.SendSMS(SMS))
                {
                }
                else
                {
                    cs.WebLogger.WriteErroLog("注册短信发送错误");    //输出到文件中
                }
            }



            if (Request["action"] == "register")
            {
                Model.ContractApplication contractApplication = DAL.ContractApplication.GetModel(Session["ContractID"].ToString());
                string user    = Request.Form["userPhone"].ToString();
                string userNum = Session["num"].ToString();

                if (Request.Form["userPhone"] == Session["num"].ToString())
                {
                    contractApplication.Type = "1";



                    DAL.ContractApplication.Update1(contractApplication);
                    Response.Write("1");
                    Response.End();
                }
            }
        }
示例#7
0
        /// <summary>
        /// 增加一个单位信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool Add(Model.ContractApplication model)
        {
            string strSql = "insert into ContractApplication(ID,UserName,Contacts,Phone,Address,Price,ContractFile,Type,ApplicationTime,Remark) values(@ID,@UserName,@Contacts,@Phone,@Address,@Price,@ContractFile,@Type,@ApplicationTime,@Remark)";

            SqlParameter ID              = new SqlParameter("ID", SqlDbType.NVarChar); ID.Value = model.ID;
            SqlParameter UserName        = new SqlParameter("UserName", SqlDbType.NVarChar); UserName.Value = model.UserName;
            SqlParameter Contacts        = new SqlParameter("Contacts", SqlDbType.NVarChar); Contacts.Value = model.Contacts;
            SqlParameter Phone           = new SqlParameter("Phone", SqlDbType.NVarChar); Phone.Value = model.Phone;
            SqlParameter Address         = new SqlParameter("Address", SqlDbType.NVarChar); Address.Value = model.Address;
            SqlParameter Price           = new SqlParameter("Price", SqlDbType.NVarChar); Price.Value = model.Price;
            SqlParameter ContractFile    = new SqlParameter("ContractFile", SqlDbType.NVarChar); ContractFile.Value = model.ContractFile;
            SqlParameter Type            = new SqlParameter("Type", SqlDbType.NVarChar); Type.Value = model.Type;
            SqlParameter ApplicationTime = new SqlParameter("ApplicationTime", SqlDbType.NVarChar); ApplicationTime.Value = model.ApplicationTime;
            SqlParameter Remark          = new SqlParameter("Remark", SqlDbType.NVarChar); Remark.Value = model.Remark;



            return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { ID, UserName, Contacts, Phone, Address, Price, ContractFile, Type, ApplicationTime, Remark }, connectionString) == 1 ? true : false);
        }
示例#8
0
        private void DownloadAll()
        {
            if (Session["UserName"] == null)
            {
            }
            else
            {
                Model.ContractApplication contractApplication = DAL.ContractApplication.GetModel(Session["id"].ToString());

                try
                {
                    string             fullPathUrl = Server.MapPath(contractApplication.ContractFile); //获取下载文件的路劲
                    System.IO.FileInfo file        = new System.IO.FileInfo(fullPathUrl);
                    if (file.Exists)                                                                   //判断文件是否存在
                    {
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.Buffer = false;
                        Response.AddHeader("content-disposition", "attachment;filename=" + file.Name);
                        Response.AddHeader("cintent_length", "attachment;filename=" + HttpUtility.UrlDecode(file.Name));
                        Response.AddHeader("cintent_length", file.Length.ToString());
                        Response.ContentType = "application/octet-stream";
                        Response.WriteFile(file.FullName);//通过response对象,执行下载操作
                        Response.Flush();
                        Response.End();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "dd", "alert('文件不存在')", true);
                    }
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "dd", "alert('下载成功')", true);
                }
            }
        }
示例#9
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.ContractApplication contractApplication = DAL.ContractApplication.GetModel(Session["id"].ToString());
     Response.Redirect("FormalContract.aspx?id=" + contractApplication.ID);
 }