protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } DAL.HP.PrintCodeDAL dalPrintCode = new DAL.HP.PrintCodeDAL(); switch (strAction) { case "reset": if (dalPrintCode.ResetPrintCode(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
protected void btnCreatePrintCode_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtAmount.Text) || txtAmount.Text == "0") { MessageBox.Show(this, "请输入打印数量!"); return; } DAL.HP.PrintCodeDAL dalPrintCode = new DAL.HP.PrintCodeDAL(); dalPrintCode.CreatePrintCode(int.Parse(txtAmount.Text), Session["strSiteCode"].ToString(), ddlClientID.SelectedValue.ToString(), "2014-01-01", "2019-12-31"); btnQuery_Click(null, null); //Response.Write("<script language=JavaScript>__doPostBack('btnQuery', '')</script>"); //Response.End(); }
public string CreatePrintCode(int iAmount, string strSIteCode, string strClientCode, string strStart, string strEnd) { DAL.HP.PrintCodeDAL dal = new DAL.HP.PrintCodeDAL(); DataSet ds = dal.CreatePrintCode(iAmount, strSIteCode, strClientCode, strStart, strEnd); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //return Common.Common.DataTableToJson("ClientCode", ds.Tables[0]); return(JsonConvert.SerializeObject(ds.Tables[0])); } else { return("0"); } }
void LoadData(string strWhere) { DAL.HP.PrintCodeDAL dalPrintCode = new DAL.HP.PrintCodeDAL(); DataSet ds = dalPrintCode.GetPrintCodeByWhere(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); this.ddlState.Items.Clear(); SYSDictionaryDAL didal = new SYSDictionaryDAL(); DataSet dids = new DataSet(); dids = didal.GetDictionaryList(""); DataTable dt = dids.Tables[0]; DataRow dr = dids.Tables[0].NewRow(); dr["ID"] = "0"; dr["Remark"] = "--全部--"; dt.Rows.InsertAt(dr, 0); this.ddlState.DataSource = dids.Tables[0].DefaultView; this.ddlState.DataTextField = "Remark"; this.ddlState.DataValueField = "ID"; this.ddlState.DataBind(); }
public bool UpdatePrintState(string strPhotoID, string strState) { DAL.HP.PrintCodeDAL dal = new DAL.HP.PrintCodeDAL(); return(dal.UpdatePrintState(strPhotoID, strState)); }
public DataSet GetPrintPhoto(string strSiteCode, string strClientCode) { DAL.HP.PrintCodeDAL dal = new DAL.HP.PrintCodeDAL(); return(dal.getPrintPhoto(strSiteCode, strClientCode)); }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); Model.Album.UserPhoto model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode.ToString(); strOpenID = model.OpenId.ToString(); strThumbMsg = Common.Common.NoHtml(Request.Form["thumbMsg"].ToString()); strPrintCode = Common.Common.NoHtml(Request.Form["printCode"].ToString()); //通过打印码得到打印端ID DAL.HP.HPClientDAL dalClient = new DAL.HP.HPClientDAL(); DataSet dsClient = dalClient.GetPrintClient(strSiteCode, strPrintCode); if (null != dsClient && dsClient.Tables.Count > 0 && dsClient.Tables[0].Rows.Count > 0) { strClientID = dsClient.Tables[0].Rows[0]["ClientCode"].ToString(); } else { DAL.HP.PrintCodeDAL dalCode = new DAL.HP.PrintCodeDAL(); strClientID = dalCode.GetClientIDByPrintCode(strPrintCode, strSiteCode); } if (string.IsNullOrEmpty(strClientID)) { Response.Write("<script>alert('打印码已经使用过!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); return; } //插入打印数据 ID,SiteCode,OpenId,ClientID,PrintCode,Img,State,AttachText DAL.HP.PhotoDAL dalPhoto = new DAL.HP.PhotoDAL(); if (null != dsClient && dsClient.Tables.Count > 0 && dsClient.Tables[0].Rows.Count > 0) { int iPrintcount = 1; iPrintcount = int.Parse(dsClient.Tables[0].Rows[0]["FreeAmount"].ToString()); if (dalPhoto.OpenIDPhotoCount(strOpenID, strPrintCode) > iPrintcount) { Response.Write("<script>alert('你已经提交过打印照片!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } else { //照片处理 string[] urls = model.FilePath.Split('.'); strFilePath = model.FilePath; string _url = strSiteCode + "_" + strOpenID + "." + urls.Last(); string inputurl = Server.MapPath("~/User_Photo/") + strFilePath; string outputurl = Server.MapPath("~/HP_Photo/") + _url; int width = 260; int height = 260; System.IO.FileStream fs = new System.IO.FileStream(inputurl, System.IO.FileMode.Open); CutForCustom(fs, outputurl, width, height, 100); fs.Close(); Model.HP.Photo modelPhoto = new Model.HP.Photo() { SiteCode = strSiteCode, OpenId = strOpenID, ClientID = strClientID, PrintCode = strPrintCode, Img = strSiteCode + "_" + strOpenID + "." + model.FilePath.Split('.').Last(), AttachText = strThumbMsg }; dalPhoto.InsertInfo(modelPhoto); Response.Write("<script>alert('提交成功!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } } else { //照片处理 string[] urls = model.FilePath.Split('.'); strFilePath = model.FilePath; string _url = strSiteCode + "_" + strOpenID + "." + urls.Last(); string inputurl = Server.MapPath("~/User_Photo/") + strFilePath; string outputurl = Server.MapPath("~/HP_Photo/") + _url; int width = 260; int height = 260; System.IO.FileStream fs = new System.IO.FileStream(inputurl, System.IO.FileMode.Open); CutForCustom(fs, outputurl, width, height, 100); fs.Close(); Model.HP.Photo modelPhoto = new Model.HP.Photo() { SiteCode = strSiteCode, OpenId = strOpenID, ClientID = strClientID, PrintCode = strPrintCode, Img = strSiteCode + "_" + strOpenID + "." + model.FilePath.Split('.').Last(), AttachText = strThumbMsg }; dalPhoto.InsertInfo(modelPhoto); Response.Write("<script>alert('提交成功!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } }