public sbyte CrockPotMaxPriority = -128; //优先度最大值 #endregion //添加食材 private void CS_Add(string Name) { if (CS_Recipe_1 == "") { CS_Recipe_1 = Name; Image_CS_Food_1.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_2 == "") { CS_Recipe_2 = Name; Image_CS_Food_2.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_3 == "") { CS_Recipe_3 = Name; Image_CS_Food_3.Source = RSN.PictureShortName(Name); } else if (CS_Recipe_4 == "") { CS_Recipe_4 = Name; Image_CS_Food_4.Source = RSN.PictureShortName(Name); } if (CS_Recipe_1 != "" && CS_Recipe_2 != "" && CS_Recipe_3 != "" && CS_Recipe_4 != "") { CS_CrockPotCalculation(); } }
protected void radgvEvents_ItemCommand(object sender, GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); SqlCommand cmd = new SqlCommand("Proc_Events", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@i", 5); cmd.Parameters.AddWithValue("@RSN", RSN); if (con.State.Equals(ConnectionState.Open)) { con.Close(); } con.Open(); SqlDataReader drselect = cmd.ExecuteReader(); if (drselect.HasRows) { while (drselect.Read()) { string strchkdate = "1900-01-01"; if (Convert.ToDateTime(drselect["FromDate"]) > Convert.ToDateTime(strchkdate)) { FromDate.SelectedDate = Convert.ToDateTime(drselect["FromDate"]); //FromDate.SelectedDate = Convert.ToDateTime(drselect["TillDate"]); } txtEventName.Text = drselect["EventName"].ToString(); txtdesc.Text = drselect["Description"].ToString(); TxtImge.Text = drselect["Image"].ToString(); string stvalue = drselect["Status"].ToString(); ddlupstatus.SelectedValue = drselect["Status"].ToString(); btnUpdate.Visible = true; btnAddEvent.Visible = false; lblcstatus.Visible = true; ddlupstatus.Visible = true; } } drselect.Close(); con.Close(); } else { LoadGrid(); } }
protected void LnkEditItemMaster_Click1(object sender, EventArgs e) { try { LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[2].Text; ViewState["ItemRSN"] = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsIT = null; dsIT = proc.ExecuteSP("SP_GetItem", new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = RSN }); if (dsIT.Tables[0].Rows.Count > 0) { ItemCode.Text = dsIT.Tables[0].Rows[0]["ItemCode"].ToString(); ItemName.Text = dsIT.Tables[0].Rows[0]["ItemName"].ToString(); ddlUOM.Text = dsIT.Tables[0].Rows[0]["UOM"].ToString(); ddlitmCategory.SelectedValue = dsIT.Tables[0].Rows[0]["Category"].ToString(); string strserveqty = dsIT.Tables[0].Rows[0]["Session"].ToString(); if (strserveqty != "") { ddlMISession.SelectedValue = dsIT.Tables[0].Rows[0]["Session"].ToString(); } txtMIServeQty.Text = dsIT.Tables[0].Rows[0]["ServeQty"].ToString(); ddlitmType.SelectedValue = dsIT.Tables[0].Rows[0]["Type"].ToString(); txtQtyAlert.Text = dsIT.Tables[0].Rows[0]["QtyAlert"].ToString(); txtLeadTime.Text = dsIT.Tables[0].Rows[0]["LeadTime"].ToString(); txtRate.Text = dsIT.Tables[0].Rows[0]["Rate"].ToString(); txtRemarks.Text = dsIT.Tables[0].Rows[0]["Remarks"].ToString(); btnUpteItm.Visible = true; btnSaveItm.Visible = false; pnlMenuItem.Visible = true; } dsIT.Dispose(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { txtRMCode.Enabled = false; btnSave.Visible = false; //btnDelete.Visible = true; btnUpdate.Visible = true; btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); //DataSet dsDT = null; DataSet dsDT = sqlobj.ExecuteSP("Proc_RawMaterial", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 6 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); txtRMCode.Text = dsDT.Tables[0].Rows[0]["RMCode"].ToString(); txtRMName.Text = dsDT.Tables[0].Rows[0]["RMName"].ToString(); ddlIUOM.SelectedValue = dsDT.Tables[0].Rows[0]["ReceiptUOM"].ToString(); ddlIUOM.SelectedValue = dsDT.Tables[0].Rows[0]["IssueUOM"].ToString(); //txtOpeningStock.Text = dsDT.Tables[0].Rows[0]["OpeningStock"].ToString(); //dtpOpeningStk.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["OSDate"].ToString()); txtClosingStock.Text = dsDT.Tables[0].Rows[0]["ClosingStock"].ToString(); dtpClosingStk.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CSDate"].ToString()); txtSupp.Text = dsDT.Tables[0].Rows[0]["Supplier"].ToString(); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); ddlGroup.SelectedValue = dsDT.Tables[0].Rows[0]["StockGroup"].ToString(); ddlCategory.SelectedValue = dsDT.Tables[0].Rows[0]["Category"].ToString().Trim(); txtReorderlevel.Text = dsDT.Tables[0].Rows[0]["ReOrderLevel"].ToString(); txtminstock.Text = dsDT.Tables[0].Rows[0]["MinStock"].ToString(); txtRate.Text = dsDT.Tables[0].Rows[0]["AvgRate"].ToString(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
public ExpanderStackpanel(string textblockText = "", string imageSource = "") { InitializeComponent(); UCTextBlock.Text = textblockText; if (imageSource != "") { Thickness T = new Thickness(); T.Left = 32; UCTextBlock.Margin = T; UCImage.Visibility = Visibility.Visible; UCImage.Source = RSN.PictureShortName(imageSource); } }
public ButtonWithPicture(string imageSource, string imageSourceSecond = "") { InitializeComponent(); if (imageSourceSecond == "") { UCImage.Source = RSN.PictureShortName(RSN.ShortName(imageSource)); } else { UCImage.Source = RSN.PictureShortName(RSN.ShortName(imageSource, imageSourceSecond)); } //MessageBox.Show(UCImage.Source.ToString()); }
protected void radgvEvents_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); SqlCommand cmd = new SqlCommand("Proc_Events", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@i", 5); cmd.Parameters.AddWithValue("@RSN", RSN); if (con.State.Equals(ConnectionState.Open)) { con.Close(); } con.Open(); SqlDataReader drselect = cmd.ExecuteReader(); if (drselect.HasRows) { while (drselect.Read()) { lblfromdate.MinDate = Convert.ToDateTime(drselect["FromDate"]); lbltodate.MinDate = Convert.ToDateTime(drselect["FromDate"]); hbtnRSN.Value = RSN.ToString(); string strchkdate = "1900-01-01"; if (Convert.ToDateTime(drselect["FromDate"]) > Convert.ToDateTime(strchkdate)) { lblfromdate.SelectedDate = Convert.ToDateTime(drselect["FromDate"]); lbltodate.SelectedDate = Convert.ToDateTime(drselect["TillDate"]); } lblevent.Text = drselect["EventName"].ToString(); lblevedesc.Text = drselect["Description"].ToString(); string stvalue = drselect["Status"].ToString(); ddlupstatus.SelectedValue = drselect["Status"].ToString(); } } drselect.Close(); con.Close(); this.ModalPopupExtender1.Show(); } else if (strLastEvent == "OnComing") { LoadGrid(); } else { lbtnAll_Click(sender, null); } }
//窗口置顶 private void Se_button_Topmost_Click(object sender, RoutedEventArgs e) { if (Topmost == false) { Topmost = true; Se_image_Topmost.Source = RSN.PictureShortName(RSN.ShortName("Setting_Top_T")); Se_textblock_Topmost.Text = "永远置顶"; RegeditRW.RegWrite("Topmost", 1); } else { Topmost = false; Se_image_Topmost.Source = RSN.PictureShortName(RSN.ShortName("Setting_Top_F")); Se_textblock_Topmost.Text = "永不置顶"; RegeditRW.RegWrite("Topmost", 0); } }
protected void lnkView_Click(object sender, EventArgs e) { try { btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsSTR = sqlobj.ExecuteSP("SP_FetchStockTransaction", new SqlParameter() { ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 1 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Int, Value = RSN }); ddlItemCode.SelectedValue = dsSTR.Tables[0].Rows[0]["ItemCode"].ToString(); txtIUOM.Text = dsSTR.Tables[0].Rows[0]["IssueUOM"].ToString(); txtClosingStk.Text = dsSTR.Tables[0].Rows[0]["ClosingStock"].ToString(); hdnItem.Value = ddlItemCode.SelectedValue; LoadTransType(); ddlTransactionType.SelectedValue = dsSTR.Tables[0].Rows[0]["TransactionCode"].ToString(); txtQty.Text = dsSTR.Tables[0].Rows[0]["Qty"].ToString(); txtRemarks.Text = dsSTR.Tables[0].Rows[0]["Reference"].ToString(); txtSupplierName.Text = dsSTR.Tables[0].Rows[0]["SupplierName"].ToString(); txtInvoiceNo.Text = dsSTR.Tables[0].Rows[0]["InvoiceNo"].ToString(); dtpInoviceDt.SelectedDate = Convert.ToDateTime(dsSTR.Tables[0].Rows[0]["InvoiceDt"].ToString()); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
//烹饪结果跳转 private void button_CS_Food_Result_Click(object sender, RoutedEventArgs e) { foreach (UIElement expanderStackpanel in WrapPanel_Right_Food.Children) { foreach (UIElement buttonWithText in ((ExpanderStackpanel)expanderStackpanel).UCWrapPanel.Children) { string[] RightButtonTag = (string[])(((ButtonWithText)buttonWithText).UCButton.Tag); string RightButtonTag0 = RightButtonTag[0]; RightButtonTag0 = RSN.GetFileName(RightButtonTag0); if (CrockPotList[FoodIndex] == RightButtonTag0) { Sidebar_Food_Click(null, null); Sidebar_Food.IsChecked = true; WrapPanel_Left_Food.UpdateLayout(); Food_Click(((ButtonWithText)buttonWithText).UCButton, null); WrapPanel_Left_Food.UpdateLayout(); //Point point = ((ButtonWithText)buttonWithText).TransformToVisual(WrapPanel_Right_Food).Transform(new Point(0, 0)); //ScrollViewer_Right_Food.ScrollToVerticalOffset(point.Y); } } } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; //ViewState["MenuRSN"] = RSN.ToString(); hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); //DataSet dsDT = null; DataSet dsDT = sqlobj.ExecuteSP("SP_FetchBillingDays", new SqlParameter() { ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 2 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); ddlResident.SelectedValue = dsDT.Tables[0].Rows[0]["RTRSN"].ToString(); dtpFromDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["FromDt"].ToString()); dtpTillDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["TillDt"].ToString()); ddlBillingMonth.SelectedValue = dsDT.Tables[0].Rows[0]["BillingMonth"].ToString(); txtNoDaysDinned.Text = dsDT.Tables[0].Rows[0]["DNNoDays"].ToString(); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void radgvEvents_ItemCommand(object sender, GridCommandEventArgs e) { Int64 RSN; if (e.CommandName == "UpdateRow") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); DataSet dsEventConfirmation = sqlobj.ExecuteSP("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 5 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = RSN }); if (dsEventConfirmation.Tables[0].Rows.Count > 0) { string strchkdate = "1900-01-01"; if (Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString()) > Convert.ToDateTime(strchkdate)) { FromDate.SelectedDate = Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString()); TillDate.SelectedDate = Convert.ToDateTime(dsEventConfirmation.Tables[0].Rows[0]["TillDate"].ToString()); } if (dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString() == "" || dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString() == null) { dtpFromTime.SelectedDate = null; } else { dtpFromTime.SelectedDate = DateTime.Parse(dsEventConfirmation.Tables[0].Rows[0]["Time"].ToString()); } txtEventName.Text = dsEventConfirmation.Tables[0].Rows[0]["EventName"].ToString(); txtdesc.Text = dsEventConfirmation.Tables[0].Rows[0]["Description"].ToString(); TxtImge.Text = dsEventConfirmation.Tables[0].Rows[0]["Image"].ToString(); string stvalue = dsEventConfirmation.Tables[0].Rows[0]["Status"].ToString(); ddlupstatus.SelectedValue = dsEventConfirmation.Tables[0].Rows[0]["Status"].ToString(); btnUpdate.Visible = true; btnAddEvent.Visible = false; lblcstatus.Visible = true; ddlupstatus.Visible = true; } dsEventConfirmation.Dispose(); } else if (e.CommandName == "Events") { RSN = Convert.ToInt64(e.CommandArgument.ToString()); Session["RSN"] = RSN.ToString(); DataSet dsEventConfirmation = sqlobj.ExecuteSP("Proc_Events", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 5 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = RSN }); if (dsEventConfirmation.Tables[0].Rows.Count > 0) { lblEventName.Text = dsEventConfirmation.Tables[0].Rows[0]["EventName"].ToString(); lblEventDate.Text = dsEventConfirmation.Tables[0].Rows[0]["FromDate"].ToString(); } if (dsEventConfirmation.Tables[1].Rows.Count > 0) { lblTotalResident.Text = "(" + dsEventConfirmation.Tables[1].Rows[0]["NoofResidnts"].ToString() + ")"; } if (dsEventConfirmation.Tables[2].Rows.Count > 0) { lblTotalAttending.Text = "(" + dsEventConfirmation.Tables[2].Rows[0]["Attending"].ToString() + ")"; } if (dsEventConfirmation.Tables[3].Rows.Count > 0) { lblTotalAttended.Text = "(" + dsEventConfirmation.Tables[3].Rows[0]["Attended"].ToString() + ")"; } dsEventConfirmation.Dispose(); rwEventRating.Visible = true; } else if (e.CommandName == "Image") { //string jsFunc = "OpenModelPopup(" + e.CommandArgument.ToString() + ")"; //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "myJsFn", jsFunc, true); string imagename = "280616090653_city.jpg"; ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "updatePanel1Script", "javascript:OpenModelPopup(" + imagename.ToString() + ")", true); } else { LoadGrid(); } }
//烹饪结果图片 private void CS_image_Food_Result_Source(string source) { Image_CS_Food_Result.Source = RSN.PictureShortName(RSN.ShortName(source, CS_ResourceDir)); }
//处理XML private void HandleXml(XmlNode list) { if (WrapPanel_Left_Character != null) { WrapPanel_Left_Character.Children.Clear(); } if (WrapPanel_Right_Character != null) { WrapPanel_Right_Character.Children.Clear(); } if (WrapPanel_Left_Food != null) { WrapPanel_Left_Food.Children.Clear(); } if (WrapPanel_Right_Food != null) { WrapPanel_Right_Food.Children.Clear(); } foreach (XmlNode Node in list) { #region "人物" if (Node.Name == "CharacterNode") { foreach (XmlNode childNode in Node) { if (childNode.Name == "Character") { string Picture = ""; string Name = ""; string EnName = ""; string Motto = ""; string Descriptions_1 = ""; string Descriptions_2 = ""; string Descriptions_3 = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string LogMeter = ""; string Damage = ""; string DamageDay = ""; string DamageDusk = ""; string DamageNight = ""; string Introduce = ""; foreach (XmlNode Character in childNode) { switch (Character.Name) { case "Picture": Picture = RSN.ShortName(Character.InnerText, "GameResources/Character/"); break; case "Name": Name = Character.InnerText; break; case "EnName": EnName = Character.InnerText; break; case "Motto": Motto = Character.InnerText; break; case "Descriptions_1": Descriptions_1 = Character.InnerText; break; case "Descriptions_2": Descriptions_2 = Character.InnerText; break; case "Descriptions_3": Descriptions_3 = Character.InnerText; break; case "Health": Health = Character.InnerText; break; case "Hunger": Hunger = Character.InnerText; break; case "Sanity": Sanity = Character.InnerText; break; case "LogMeter": LogMeter = Character.InnerText; break; case "Damage": Damage = Character.InnerText; break; case "DamageDay": DamageDay = Character.InnerText; break; case "DamageDusk": DamageDusk = Character.InnerText; break; case "DamageNight": DamageNight = Character.InnerText; break; case "Introduce": Introduce = Character.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.Height = 205; BWT.Width = 140; BWT.ButtonGrid.Height = 190; BWT.ButtonGrid.Width = 140; BWT.GridPictureHeight.Height = new GridLength(160); BWT.UCImage.Height = 160; BWT.UCImage.Width = 140; BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.FontSize = 20; BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Motto, Descriptions_1, Descriptions_2, Descriptions_3, Health, Hunger, Sanity, LogMeter, Damage, DamageDay, DamageDusk, DamageNight, Introduce }; object obj = BWTTag; if (Name == "威尔逊") { Character_Click_Handle(BWTTag); } BWT.UCButton.Tag = obj; BWT.UCButton.Click += Character_Click; try { WrapPanel_Right_Character.Children.Add(BWT); } catch { } } } } #endregion #region "食物" if (Node.Name == "FoodNode") { foreach (XmlNode childNode in Node) { switch (childNode.Name) { #region "食谱" case "FoodRecipe": ExpanderStackpanel ESRecipe = new ExpanderStackpanel("食谱", "../Resources/CP_CrockPot.png"); WrapPanel_Right_Food.Children.Add(ESRecipe); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string PortableCrockPot = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Cooktime = ""; string Priority = ""; string NeedPicture_1 = ""; string Need_1 = ""; string NeedPicture_or = ""; string Need_or = ""; string NeedPicture_2 = ""; string Need_2 = ""; string NeedPicture_3 = ""; string Need_3 = ""; string Restrictions_1 = ""; string RestrictionsAttributes_1 = ""; string Restrictions_2 = ""; string RestrictionsAttributes_2 = ""; string Restrictions_3 = ""; string RestrictionsAttributes_3 = ""; string Restrictions_4 = ""; string RestrictionsAttributes_4 = ""; string Restrictions_5 = ""; string RestrictionsAttributes_5 = ""; string Recommend_1 = ""; string Recommend_2 = ""; string Recommend_3 = ""; string Recommend_4 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "PortableCrockPot": PortableCrockPot = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Cooktime": Cooktime = Food.InnerText; break; case "Priority": Priority = Food.InnerText; break; case "NeedPicture_1": NeedPicture_1 = Food.InnerText; break; case "Need_1": Need_1 = Food.InnerText; break; case "NeedPicture_or": NeedPicture_or = Food.InnerText; break; case "Need_or": Need_or = Food.InnerText; break; case "NeedPicture_2": NeedPicture_2 = Food.InnerText; break; case "Need_2": Need_2 = Food.InnerText; break; case "NeedPicture_3": NeedPicture_3 = Food.InnerText; break; case "Need_3": Need_3 = Food.InnerText; break; case "Restrictions_1": Restrictions_1 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_1 = Food.Attributes["pre"].Value; } break; case "Restrictions_2": Restrictions_2 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_2 = Food.Attributes["pre"].Value; } break; case "Restrictions_3": Restrictions_3 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_3 = Food.Attributes["pre"].Value; } break; case "Restrictions_4": Restrictions_4 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_4 = Food.Attributes["pre"].Value; } break; case "Restrictions_5": Restrictions_5 = Food.InnerText; if (Food.Attributes["pre"] != null) { RestrictionsAttributes_5 = Food.Attributes["pre"].Value; } break; case "Recommend_1": Recommend_1 = Food.InnerText; break; case "Recommend_2": Recommend_2 = Food.InnerText; break; case "Recommend_3": Recommend_3 = Food.InnerText; break; case "Recommend_4": Recommend_4 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, PortableCrockPot, Health, Hunger, Sanity, Perish, Cooktime, Priority, NeedPicture_1, Need_1, NeedPicture_or, Need_or, NeedPicture_2, Need_2, NeedPicture_3, Need_3, Restrictions_1, RestrictionsAttributes_1, Restrictions_2, RestrictionsAttributes_2, Restrictions_3, RestrictionsAttributes_3, Restrictions_4, RestrictionsAttributes_4, Restrictions_5, RestrictionsAttributes_5, Recommend_1, Recommend_2, Recommend_3, Recommend_4, Introduce }; object obj = BWTTag; if (Name == "培根煎蛋") { Food_Recipe_Click_Handle(BWTTag); } BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Recipe_Click; try { ESRecipe.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "肉类" case "FoodMeats": ExpanderStackpanel ESMeast = new ExpanderStackpanel("肉类", "../Resources/GameResources/Food/FC_Meats.png"); WrapPanel_Right_Food.Children.Add(ESMeast); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESMeast.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "蔬菜" case "FoodVegetables": ExpanderStackpanel ESVegetables = new ExpanderStackpanel("蔬菜", "../Resources/GameResources/Food/FC_Vegetables.png"); WrapPanel_Right_Food.Children.Add(ESVegetables); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESVegetables.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "水果" case "FoodFruit": ExpanderStackpanel ESFruit = new ExpanderStackpanel("水果", "../Resources/GameResources/Food/FC_Fruit.png"); WrapPanel_Right_Food.Children.Add(ESFruit); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESFruit.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "蛋类" case "FoodEggs": ExpanderStackpanel ESEggs = new ExpanderStackpanel("蛋类", "../Resources/GameResources/Food/FC_Eggs.png"); WrapPanel_Right_Food.Children.Add(ESEggs); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESEggs.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "其他" case "FoodOthers": ExpanderStackpanel ESOthers = new ExpanderStackpanel("其他", "../Resources/GameResources/Food/F_twigs.png"); WrapPanel_Right_Food.Children.Add(ESOthers); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string AttributeValue = ""; string Attribute_2 = ""; string AttributeValue_2 = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "AttributeValue": AttributeValue = Food.InnerText; break; case "Attribute_2": Attribute_2 = Food.InnerText; break; case "AttributeValue_2": AttributeValue_2 = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, AttributeValue, Attribute_2, AttributeValue_2, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_Click; try { ESOthers.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion #region "非食材" case "FoodNoFC": ExpanderStackpanel ESNoFC = new ExpanderStackpanel("非食材", "../Resources/GameResources/Food/F_petals.png"); WrapPanel_Right_Food.Children.Add(ESNoFC); foreach (XmlNode Level2childNode in childNode) { if (Level2childNode.Name == "Food") { string Picture = ""; string Name = ""; string EnName = ""; string Health = ""; string Hunger = ""; string Sanity = ""; string Perish = ""; string Attribute = ""; string Introduce = ""; foreach (XmlNode Food in Level2childNode) { switch (Food.Name) { case "Picture": Picture = RSN.ShortName(Food.InnerText, "GameResources/Food/"); break; case "Name": Name = Food.InnerText; break; case "EnName": EnName = Food.InnerText; break; case "Health": Health = Food.InnerText; break; case "Hunger": Hunger = Food.InnerText; break; case "Sanity": Sanity = Food.InnerText; break; case "Perish": Perish = Food.InnerText; break; case "Attribute": Attribute = Food.InnerText; break; case "Introduce": Introduce = Food.InnerText; break; } } ButtonWithText BWT = new ButtonWithText(); BWT.UCImage.Source = RSN.PictureShortName(Picture); BWT.UCTextBlock.Text = Name; string[] BWTTag = { Picture, Name, EnName, Health, Hunger, Sanity, Perish, Attribute, Introduce }; object obj = BWTTag; BWT.UCButton.Tag = obj; BWT.UCButton.Click += Food_NoFC_Click; try { ESNoFC.UCWrapPanel.Children.Add(BWT); } catch { } } } break; #endregion } } } #endregion } }
//WrapPanel_Left_Character控件创建事件 private void Character_Click_Handle(string[] BWTTag) { try { WrapPanel_Left_Character.Children.Clear();//清空WrapPanel_Left_Character Grid GI = new Grid(); GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); #region "图片 BWTTag[0]" Grid gPicture = PG.GridInit(180); Image iPicture = new Image(); iPicture.Height = 160; iPicture.Width = 140; iPicture.HorizontalAlignment = HorizontalAlignment.Center; iPicture.Source = RSN.PictureShortName(BWTTag[0]); gPicture.Children.Add(iPicture); WrapPanel_Left_Character.Children.Add(gPicture); #endregion GI = PG.GridInterval(5); WrapPanel_Left_Character.Children.Add(GI); #region "中文名 BWTTag[1]" Grid gName = PG.GridInit(); TextBlock tbName = new TextBlock(); tbName.HorizontalAlignment = HorizontalAlignment.Center; tbName.Text = BWTTag[1]; tbName.FontSize = 26.667; gName.Children.Add(tbName); WrapPanel_Left_Character.Children.Add(gName); #endregion #region "英文名 BWTTag[2]" Grid gEnName = PG.GridInit(); TextBlock tbEnName = new TextBlock(); tbEnName.HorizontalAlignment = HorizontalAlignment.Center; tbEnName.Text = BWTTag[2]; tbEnName.FontSize = 26.667; tbEnName.Margin = new Thickness(-5, 0, 0, 0); gEnName.Children.Add(tbEnName); WrapPanel_Left_Character.Children.Add(gEnName); #endregion #region "座右铭 BWTTag[3]" if (BWTTag[3] != "") { GI = PG.GridInterval(5); WrapPanel_Left_Character.Children.Add(GI); Grid gMotto = PG.GridInit(20); TextBlock tbMotto = new TextBlock(); tbMotto.HorizontalAlignment = HorizontalAlignment.Center; tbMotto.Text = BWTTag[3]; tbMotto.FontSize = 16; gMotto.Children.Add(tbMotto); WrapPanel_Left_Character.Children.Add(gMotto); } #endregion #region "描述_1 BWTTag[4]" if (BWTTag[4] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDescriptions_1 = PG.GridInit(); TextBlock tbDescriptions_1 = new TextBlock(); tbDescriptions_1.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_1.Text = BWTTag[4]; tbDescriptions_1.FontSize = 14; tbDescriptions_1.Margin = new Thickness(25, 0, 0, 0); gDescriptions_1.Children.Add(tbDescriptions_1); WrapPanel_Left_Character.Children.Add(gDescriptions_1); } #endregion #region "描述_2 BWTTag[5]" if (BWTTag[5] != "") { Grid gDescriptions_2 = PG.GridInit(); TextBlock tbDescriptions_2 = new TextBlock(); tbDescriptions_2.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_2.Text = BWTTag[5]; tbDescriptions_2.FontSize = 14; tbDescriptions_2.Margin = new Thickness(25, 0, 0, 0); gDescriptions_2.Children.Add(tbDescriptions_2); WrapPanel_Left_Character.Children.Add(gDescriptions_2); } #endregion #region "描述_3 BWTTag[6]" if (BWTTag[6] != "") { Grid gDescriptions_3 = PG.GridInit(); TextBlock tbDescriptions_3 = new TextBlock(); tbDescriptions_3.HorizontalAlignment = HorizontalAlignment.Left; tbDescriptions_3.Text = BWTTag[6]; tbDescriptions_3.FontSize = 14; tbDescriptions_3.Margin = new Thickness(25, 0, 0, 0); gDescriptions_3.Children.Add(tbDescriptions_3); WrapPanel_Left_Character.Children.Add(gDescriptions_3); } #endregion #region "生命 BWTTag[7]" if (BWTTag[7] != "") { GI = PG.GridInterval(25); WrapPanel_Left_Character.Children.Add(GI); Grid gHealth = PG.GridInit(15); PropertyBar pbHealth = new PropertyBar(); pbHealth.UCTextBlockName.Width = 57; pbHealth.UCTextBlockName.Text = "生命"; pbHealth.UCProgressBar.Value = Convert.ToDouble(BWTTag[7]) / 3; pbHealth.UCProgressBar.Foreground = BC.brushConverter(PBCGreen); pbHealth.UCTextBlockValue.Width = 32; pbHealth.UCTextBlockValue.Text = BWTTag[7]; gHealth.Children.Add(pbHealth); WrapPanel_Left_Character.Children.Add(gHealth); } #endregion #region "饥饿 BWTTag[8]" if (BWTTag[8] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gHunger = PG.GridInit(15); PropertyBar pbHunger = new PropertyBar(); pbHunger.UCTextBlockName.Width = 57; pbHunger.UCTextBlockName.Text = "饥饿"; pbHunger.UCProgressBar.Value = Convert.ToDouble(BWTTag[8]) / 3; pbHunger.UCProgressBar.Foreground = BC.brushConverter(PBCOrange); pbHunger.UCTextBlockValue.Width = 32; pbHunger.UCTextBlockValue.Text = BWTTag[8]; gHunger.Children.Add(pbHunger); if (BWTTag[1] == "沃尔夫冈") { Slider WolfgangSlider = new Slider(); WolfgangSlider.Style = (Style)FindResource("SliderStyle"); WolfgangSlider.Focusable = false; WolfgangSlider.IsSelectionRangeEnabled = true; WolfgangSlider.Value = 200; WolfgangSlider.Maximum = 300; WolfgangSlider.Minimum = 0; WolfgangSlider.SmallChange = 1; WolfgangSlider.LargeChange = 10; WolfgangSlider.ValueChanged += WolfgangSlider_ValueChanged; Thickness TSlider = new Thickness(); TSlider.Left = 72; TSlider.Right = 37; WolfgangSlider.Margin = TSlider; gHunger.Children.Add(WolfgangSlider); } WrapPanel_Left_Character.Children.Add(gHunger); } #endregion #region "精神 BWTTag[9]" if (BWTTag[9] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gSanity = PG.GridInit(15); PropertyBar pbSanity = new PropertyBar(); pbSanity.UCTextBlockName.Width = 57; pbSanity.UCTextBlockName.Text = "精神"; pbSanity.UCProgressBar.Value = Convert.ToDouble(BWTTag[9]) / 2.5; pbSanity.UCProgressBar.Foreground = BC.brushConverter(PBCRed); pbSanity.UCTextBlockValue.Width = 32; pbSanity.UCTextBlockValue.Text = BWTTag[9]; gSanity.Children.Add(pbSanity); WrapPanel_Left_Character.Children.Add(gSanity); } #endregion #region "树木值 BWTTag[10]" if (BWTTag[10] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "树木值"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[10]); pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCPink); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[10]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害 BWTTag[11]" if (BWTTag[11] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[11]) * 50; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; if (BWTTag[1] != "海獭伍迪") { pbDamage.UCTextBlockValue.Text = BWTTag[11] + "X"; } else { pbDamage.UCTextBlockValue.Text = BWTTag[11]; } gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(白天) BWTTag[12]" if (BWTTag[12] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(白天)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[12]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[12]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(黄昏) BWTTag[13]" if (BWTTag[13] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(黄昏)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[13]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[13]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "伤害(夜晚) BWTTag[14]" if (BWTTag[14] != "") { GI = PG.GridInterval(10); WrapPanel_Left_Character.Children.Add(GI); Grid gDamage = PG.GridInit(15); PropertyBar pbDamage = new PropertyBar(); pbDamage.UCTextBlockName.Width = 57; pbDamage.UCTextBlockName.Text = "伤害(夜晚)"; pbDamage.UCProgressBar.Value = Convert.ToDouble(BWTTag[14]) * 2.5; pbDamage.UCProgressBar.Foreground = BC.brushConverter(PBCBlue); pbDamage.UCTextBlockValue.Width = 32; pbDamage.UCTextBlockValue.Text = BWTTag[14]; gDamage.Children.Add(pbDamage); WrapPanel_Left_Character.Children.Add(gDamage); } #endregion #region "介绍 BWTTag[15]" GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); Grid gIntroduce = PG.GridInit(); TextBlock tbIntroduce = new TextBlock(); tbIntroduce.HorizontalAlignment = HorizontalAlignment.Left; tbIntroduce.TextWrapping = TextWrapping.Wrap; tbIntroduce.Text = BWTTag[15]; tbIntroduce.FontSize = 13; tbIntroduce.Margin = new Thickness(15, 0, 0, 0); gIntroduce.Children.Add(tbIntroduce); WrapPanel_Left_Character.Children.Add(gIntroduce); #endregion GI = PG.GridInterval(20); WrapPanel_Left_Character.Children.Add(GI); WrapPanel_Left_Character_SizeChanged(null, null);//调整位置 } catch { } }
//食材属性统计 private void CS_RecipeStatistics(string Name) { switch (RSN.GetFileName(Name)) { #region 肉类 case "F_meat": CS_FT_Meats += 1; break; case "F_cooked_meat": CS_FT_Meats += 1; break; case "F_jerky": CS_FT_Meats += 1; break; case "F_monster_meat": CS_FT_Meats += 1; CS_FT_MonsterFoods += 1; break; case "F_cooked_monster_meat": CS_FT_Meats += 1; CS_FT_MonsterFoods += 1; break; case "F_monster_jerky": CS_FT_Meats += 1; CS_FT_MonsterFoods += 1; break; case "F_morsel": CS_FT_Meats += 0.5; break; case "F_cooked_morsel": CS_FT_Meats += 0.5; break; case "F_small_jerky": CS_FT_Meats += 0.5; break; case "F_drumstick": CS_FT_Meats += 0.5; CS_FT_Drumstick += 1; break; case "F_fried_drumstick": CS_FT_Meats += 0.5; CS_FT_Drumstick += 1; break; case "F_frog_legs": CS_FT_Meats += 0.5; CS_FT_FrogLegs += 1; break; case "F_cooked_frog_legs": CS_FT_Meats += 0.5; CS_FT_FrogLegs += 1; break; case "F_fish": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; break; case "F_cooked_fish": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; break; case "F_eel": CS_FT_Fishes += 1; CS_FT_Eel += 1; CS_FT_Meats += 0.5; break; case "F_cooked_eel": CS_FT_Fishes += 1; CS_FT_Eel += 1; CS_FT_Meats += 0.5; break; case "F_moleworm": CS_FT_Moleworm += 1; break; case "F_limpets": CS_FT_Fishes += 0.5; CS_FT_Limpets += 1; break; case "F_cooked_limpets": CS_FT_Fishes += 0.5; break; case "F_tropical_fish": CS_FT_Meats += 0.5; CS_FT_Fishes += 1; break; case "F_fish_morsel": CS_FT_Fishes += 0.5; break; case "F_cooked_fish_morsel": CS_FT_Fishes += 0.5; break; case "F_jellyfish": CS_FT_Fishes += 1; CS_FT_MonsterFoods += 1; CS_FT_Jellyfish += 1; break; case "F_dead_jellyfish": CS_FT_Fishes += 1; CS_FT_MonsterFoods += 1; break; case "F_cooked_jellyfish": CS_FT_Fishes += 1; CS_FT_MonsterFoods += 1; break; case "F_dried_jellyfish": CS_FT_Fishes += 1; CS_FT_MonsterFoods += 1; break; case "F_mussel": CS_FT_Fishes += 0.5; CS_FT_Mussel += 1; break; case "F_cooked_mussel": CS_FT_Fishes += 0.5; CS_FT_Mussel += 1; break; case "F_dead_dogfish": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; break; case "F_wobster": CS_FT_Fishes += 2; CS_FT_Wobster += 1; break; case "F_raw_fish": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; break; case "F_fish_steak": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; break; case "F_shark_fin": CS_FT_Fishes += 1; CS_FT_Meats += 0.5; CS_FT_SharkFin += 1; break; #endregion #region 蔬菜 case "F_blue_cap": CS_FT_Vegetables += 0.5; break; case "F_cooked_blue_cap": CS_FT_Vegetables += 0.5; break; case "F_green_cap": CS_FT_Vegetables += 0.5; break; case "F_cooked_green_cap": CS_FT_Vegetables += 0.5; break; case "F_red_cap": CS_FT_Vegetables += 0.5; break; case "F_cooked_red_cap": CS_FT_Vegetables += 0.5; break; case "F_eggplant": CS_FT_Vegetables += 1; CS_FT_Eggplant += 1; break; case "F_braised_eggplant": CS_FT_Vegetables += 1; CS_FT_Eggplant += 1; break; case "F_carrot": CS_FT_Vegetables += 1; break; case "F_roasted_carrot": CS_FT_Vegetables += 1; break; case "F_corn": CS_FT_Vegetables += 1; CS_FT_Corn += 1; break; case "F_popcorn": CS_FT_Vegetables += 1; CS_FT_Corn += 1; break; case "F_pumpkin": CS_FT_Vegetables += 1; CS_FT_Pumpkin += 1; break; case "F_hot_pumpkin": CS_FT_Vegetables += 1; CS_FT_Pumpkin += 1; break; case "F_cactus_flesh": CS_FT_Vegetables += 1; CS_FT_CactusFlesh += 1; break; case "F_cooked_cactus_flesh": CS_FT_Vegetables += 1; break; case "F_cactus_flower": CS_FT_Vegetables += 0.5; CS_FT_CactusFlower += 1; break; case "F_sweet_potato": CS_FT_Vegetables += 1; CS_FT_SweetPotato += 1; break; case "F_cooked_sweet_potato": CS_FT_Vegetables += 1; break; case "F_seaweed": CS_FT_Vegetables += 0.5; CS_FT_Seaweed += 1; break; case "F_roasted_seaweed": CS_FT_Vegetables += 0.5; break; case "F_dried_seaweed": CS_FT_Vegetables += 0.5; break; #endregion #region 水果 case "F_juicy_berries": CS_FT_Fruit += 0.5; break; case "F_roasted_juicy_berries": CS_FT_Fruit += 0.5; break; case "F_berries": CS_FT_Fruit += 0.5; CS_FT_Berries += 1; break; case "F_roasted_berrie": CS_FT_Fruit += 0.5; CS_FT_Berries += 1; break; case "F_banana": CS_FT_Fruit += 1; CS_FT_Banana += 1; break; case "F_cooked_banana": CS_FT_Fruit += 1; break; case "F_dragon_fruit": CS_FT_Fruit += 1; CS_FT_DragonFruit += 1; break; case "F_prepared_dragon_fruit": CS_FT_Fruit += 1; CS_FT_DragonFruit += 1; break; case "F_durian": CS_FT_Fruit += 1; CS_FT_MonsterFoods += 1; break; case "F_extra_smelly_durian": CS_FT_Fruit += 1; CS_FT_MonsterFoods += 1; break; case "F_pomegranate": CS_FT_Fruit += 1; break; case "F_sliced_pomegranate": CS_FT_Fruit += 1; break; case "F_watermelon": CS_FT_Fruit += 1; CS_FT_Watermelon += 1; break; case "F_grilled_watermelon": CS_FT_Fruit += 1; break; case "F_halved_coconut": CS_FT_Fruit += 1; break; case "F_roasted_coconut": CS_FT_Fruit += 1; break; case "F_coffee_beans": CS_FT_Fruit += 0.5; break; case "F_roasted_coffee_beans": CS_FT_Fruit += 1; CS_FT_RoastedCoffeeBeans += 1; break; #endregion #region 蛋类 case "F_egg": CS_FT_Eggs += 1; break; case "F_cooked_egg": CS_FT_Eggs += 1; break; case "F_tallbird_egg": CS_FT_Eggs += 4; break; case "F_fried_tallbird_egg": CS_FT_Eggs += 4; break; case "F_doydoy_egg": CS_FT_Eggs += 1; break; case "F_fried_doydoy_egg": CS_FT_Eggs += 1; break; #endregion #region 其他 case "F_butterfly_wing": CS_FT_Butterfly_wings += 1; break; case "F_butterfly_wing_sw": CS_FT_Butterfly_wings += 1; break; case "F_butter": CS_FT_DairyProduct += 1; CS_FT_Butter += 1; break; case "F_honey": CS_FT_Sweetener += 1; CS_FT_Honey += 1; break; case "F_honeycomb": CS_FT_Sweetener += 1; break; case "F_lichen": CS_FT_Vegetables += 1; CS_FT_Lichen += 1; break; case "F_mandrake": CS_FT_Vegetables += 1; CS_FT_Mandrake += 1; break; case "F_electric_milk": CS_FT_DairyProduct += 1; break; case "F_ice": CS_FT_Ice += 1; break; case "F_roasted_birchnut": CS_FT_RoastedBirchnut += 1; break; case "F_royal_jelly": CS_FT_RoyalJelly += 1; break; case "F_twigs": CS_FT_Twigs += 1; break; #endregion } }
protected void LnkEditItem_Click(object sender, EventArgs e) { try { DataSet dsDT2 = null; dsDT2 = sqlobj.ExecuteSP("GetServerDateTime"); DateTime now = Convert.ToDateTime(dsDT2.Tables[0].Rows[0][0]); btnUpdate.Visible = true; btnSave.Visible = false; LinkButton lnkEdititemBtn = (LinkButton)sender; GridDataItem row = (GridDataItem)lnkEdititemBtn.NamingContainer; string RSN; RSN = row.Cells[3].Text; hdnRSN.Value = RSN.ToString(); SqlProcsNew proc = new SqlProcsNew(); DataSet dsDT = sqlobj.ExecuteSP("Proc_CheckinandoutAll", new SqlParameter() { ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 8 }, new SqlParameter() { ParameterName = "@RSN", SqlDbType = SqlDbType.Decimal, Value = RSN }); cmbResident.SelectedValue = dsDT.Tables[0].Rows[0]["RTRSN"].ToString(); txtDoorNo.Text = dsDT.Tables[0].Rows[0]["DoorNo"].ToString(); txtMobileNo.Text = dsDT.Tables[0].Rows[0]["MobileNo"].ToString(); dtpFromDate.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CheckOutDate"].ToString()); dtpFromTime.SelectedDate = Convert.ToDateTime(dsDT.Tables[0].Rows[0]["CheckOutTime"].ToString()); txtRemarks.Text = dsDT.Tables[0].Rows[0]["Remarks"].ToString(); //dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); //dtpTillDate.MaxDate = now; DateTime d1 = Convert.ToDateTime(dtpFromDate.SelectedDate); DateTime d2 = Convert.ToDateTime(now); TimeSpan t = d2 - d1; double NrOfDays = t.TotalDays; if (NrOfDays < 0) { dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.MaxDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.SelectedDate = Convert.ToDateTime(dtpFromDate.SelectedDate); } else { dtpTillDate.MinDate = Convert.ToDateTime(dtpFromDate.SelectedDate); dtpTillDate.MaxDate = now; dtpTillDate.SelectedDate = now; } trCheckIn.Visible = true; cmbResident.Enabled = false; dtpFromDate.Enabled = false; dtpFromTime.Enabled = false; } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }