protected void gvStamp_RowDeleting(object sender, GridViewDeleteEventArgs e) { int StampId = Convert.ToInt32(gvStamp.DataKeys[e.RowIndex].Value); StampInfo.DelStamp(StampId); gvDataBind(); }
protected void gvStamp_RowUpdating(object sender, GridViewUpdateEventArgs e) { int StampId = Convert.ToInt32(gvStamp.DataKeys[e.RowIndex].Value); TextBox txtApplyDate = gvStamp.Rows[e.RowIndex].FindControl("txtApplyDate") as TextBox; DropDownList ddlFileType = gvStamp.Rows[e.RowIndex].FindControl("ddlFileType") as DropDownList; DropDownList ddlStampType = gvStamp.Rows[e.RowIndex].FindControl("ddlStampType") as DropDownList; TextBox txtUse = gvStamp.Rows[e.RowIndex].FindControl("txtUse") as TextBox; TextBox txtMemo = gvStamp.Rows[e.RowIndex].FindControl("txtMemo") as TextBox; try { StampInfo stamp = new StampInfo(StampId); stamp.UseDate = txtApplyDate.Text.ToString(); stamp.StampFileTypeId = Convert.ToInt32(ddlFileType.SelectedValue); stamp.StampTypeId = Convert.ToInt32(ddlStampType.SelectedValue); stamp.Stampuse = txtUse.Text.ToString(); stamp.Memo = txtMemo.Text.ToString(); stamp.Save(); gvStamp.EditIndex = -1; gvDataBind(); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('更新失败:" + Ex.Message + "');", true); } }
public PaintToolsSlot(StampInfo stampInfo) { this.stampInfo = stampInfo; texture = Main.magicPixel; updateNeeded = true; base.onLeftClick += (a, b) => Select(); }
void OnTriggerEnter(Collider collider) { if (!_hasBeenStamped) { GameObject other = collider.gameObject; if (other.CompareTag("stamp")) { StampInfo info = other.GetComponent <StampInfo>(); if (info != null) { GameObject stampObj = Instantiate(info.stampObject); stampObj.transform.SetParent(transform); //TODO: put this at the stamp's position stampObj.transform.localPosition = new Vector3(); Vector3 objAngle = stampObj.transform.localRotation.eulerAngles; stampObj.transform.localRotation = Quaternion.Euler(0, 0, objAngle.z); _hasBeenStamped = true; _stampValue = info.isApproved; } else { Debug.Log("Stamp has no info!"); } } } }
protected void btnNo_Click(object sender, EventArgs e) { int StampId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); StampInfo stamp = new StampInfo(StampId); stamp.State = 2; stamp.Save(); gvDataBind(); }
protected void btnNo_Click(object sender, EventArgs e) { int StampId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); StampInfo stamp = new StampInfo(StampId); stamp.State = 5;//修正 stamp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('修正!');</script>"); gvDataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { int StampId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); StampInfo stamp = new StampInfo(StampId); stamp.State = 3; stamp.ApplyTime = DateTime.Now.ToString("yyyy-MM-dd"); stamp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('提交成功!');</script>"); gvDataBind(); }
protected void gvStamp_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnNo = e.Row.FindControl("btnNo") as Button; if (!Convert.IsDBNull(gvStamp.DataKeys[e.Row.RowIndex].Value)) { StampInfo stamp = new StampInfo(Convert.ToInt32(gvStamp.DataKeys[e.Row.RowIndex].Value)); if (stamp.State != 3) { btnSubmit.Enabled = false; btnNo.Enabled = false; } switch (stamp.State) { case 0: lblState.Text = "未提交"; break; case 1: lblState.Text = "待部门领导审批"; break; case 2: lblState.Text = "部门:修正"; break; case 3: lblState.Text = "待总经理审批"; break; case 4: lblState.Text = "通过"; break; case 5: lblState.Text = "总经理:修正"; break; default: lblState.Text = "其他状态"; break; } } //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; } }
protected void btnAdd_Click(object sender, EventArgs e) { StampInfo stamp = new StampInfo(); stamp.ApplyName = Session["EmployeeName"].ToString(); stamp.DepartName = Session["DepartName"].ToString(); stamp.UseDate = DateTime.Now.ToString("yyyy-MM-dd"); stamp.StampFileTypeId = 1; stamp.StampTypeId = 1; stamp.Stampuse = ""; stamp.Memo = ""; stamp.ApplyTime = ""; stamp.State = 0; stamp.Save(); gvDataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { int StampId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); StampInfo stamp = new StampInfo(StampId); StampFileTypeInfo filetype = new StampFileTypeInfo(Convert.ToInt32(stamp.StampFileTypeId)); if (filetype.StampFileTypeName == "公司文件") { stamp.State = 3;//待总经理审批 } else if (filetype.StampFileTypeName == "部门文件") { stamp.State = 4;//通过 } stamp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('通过!');</script>"); gvDataBind(); }
protected void gvDataBind() { DataTable dt = StampInfo.StampManagerGv(); DataView view = dt.DefaultView; string sort = (string)ViewState["SortExpression"] + " " + (string)ViewState["SortDir"]; view.Sort = sort; if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gvStamp, AspNetPager1); gvStamp.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvStamp, AspNetPager1); } }
internal Texture2D MakeThumbnail(StampInfo stampInfo) { int desiredWidth = 100; int desiredHeight = 100; int actualWidth = stampInfo.Width; int actualHeight = stampInfo.Height; float scale = 1; Vector2 offset = new Vector2(); if (actualWidth > desiredWidth || actualHeight > desiredHeight) { if (actualHeight > actualWidth) { scale = (float)desiredWidth / actualHeight; offset.X = (desiredWidth - actualWidth * scale) / 2; } else { scale = (float)desiredWidth / actualWidth; offset.Y = (desiredHeight - actualHeight * scale) / 2; } } offset = offset / scale; RenderTarget2D renderTarget = new RenderTarget2D(Main.graphics.GraphicsDevice, desiredWidth, desiredHeight); Main.instance.GraphicsDevice.SetRenderTarget(renderTarget); Main.instance.GraphicsDevice.Clear(Color.Transparent); Main.spriteBatch.Begin(); PaintToolsHotbar.DrawPreview(Main.spriteBatch, stampInfo.Tiles, offset, scale); Main.spriteBatch.End(); Main.instance.GraphicsDevice.SetRenderTarget(null); Texture2D mergedTexture = new Texture2D(Main.instance.GraphicsDevice, desiredWidth, desiredHeight); Color[] content = new Color[desiredWidth * desiredHeight]; renderTarget.GetData <Color>(content); mergedTexture.SetData <Color>(content); return(mergedTexture); }
public static void DrawPreview(SpriteBatch sb, StampInfo info, Vector2 position) { int maxX = info.Textures.GetLength(0); int maxY = info.Textures.GetLength(1); bool isHR = info.bFlipHorizontal; bool isVR = info.bFlipVertical ^ Main.LocalPlayer.gravDir == -1f; Texture2D[,] textures = new Texture2D[maxX, maxY]; for (int x = 0; x < maxX; x++) { for (int y = 0; y < maxY; y++) { textures[isHR ? maxX - x - 1 : x, isVR ? maxY - y - 1 : y] = info.Textures[x, y]; } } SpriteEffects effects = SpriteEffects.None; if (isHR) { effects |= SpriteEffects.FlipHorizontally; } if (isVR) { effects |= SpriteEffects.FlipVertically; } for (int x = 0; x < info.Textures.GetLength(0); x++) { Vector2 pos = position; pos.X += x * ModUtils.TextureMaxTile * 16; for (int y = 0; y < info.Textures.GetLength(1); y++) { sb.Draw(textures[x, y], pos, null, Color.White * 0.6f, 0f, Vector2.Zero, 1f, effects, 0f); pos.Y += ModUtils.TextureMaxTile * 16; } } }
protected void gvStamp_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnDelete = e.Row.FindControl("btnDelete") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; if (!Convert.IsDBNull(gvStamp.DataKeys[e.Row.RowIndex].Value)) { StampInfo stamp = new StampInfo(Convert.ToInt32(gvStamp.DataKeys[e.Row.RowIndex].Value)); if (stamp.State != 0) { btnSubmit.Enabled = false; btnDelete.Enabled = false; btnEdit.Enabled = false; } switch (stamp.State) { case 0: lblState.Text = "未提交"; break; case 1: lblState.Text = "待部门领导审批"; break; case 2: lblState.Text = "部门:修正"; break; case 3: lblState.Text = "待总经理审批"; break; case 4: lblState.Text = "通过"; break; case 5: lblState.Text = "总经理:修正"; break; default: lblState.Text = "其他状态"; break; } } DropDownList ddlFileType = e.Row.FindControl("ddlFileType") as DropDownList; if (ddlFileType != null) { DataTable dt = StampInfo.getStampFileTypeList(); ddlFileType.DataSource = dt; ddlFileType.DataTextField = "StampFileTypeName"; ddlFileType.DataValueField = "StampFileTypeId"; ddlFileType.DataBind(); } DropDownList ddlStampType = e.Row.FindControl("ddlStampType") as DropDownList; if (ddlStampType != null) { DataTable dt1 = StampInfo.getStampType(); ddlStampType.DataSource = dt1; ddlStampType.DataTextField = "StampName"; ddlStampType.DataValueField = "StampTypeId"; ddlStampType.DataBind(); } //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; } }
public void SetStamp(StampInfo stampInfo) { Debug.Assert(false); }
public void AddSlot(StampInfo stampInfo) { view.Add(new PaintToolsSlot(stampInfo)); }
public PaintToolsSlot(StampInfo stampInfo) { this.stampInfo = stampInfo; texture = stampInfo.Textures.Resize(slotSize); base.onLeftClick += (a, b) => Select(); }