protected void btnSaveDress_Click(object sender, EventArgs e) { DressType aDressType = new DressType(); aDressType.TypeName = txtDressType.Text; aDressType.DressPrice = Convert.ToDouble(txtDressPrice.Text); if (btnSaveDress.Text == "Update") { int DressTypeID = Convert.ToInt32(lbldresstypeIDhidden.Text); Savemsg = tailorBLL.UpdateDressType(aDressType, DressTypeID); btnSaveDress.Text = "Save"; listViewRowNo = 0; } else { Savemsg = tailorBLL.SaveDressType(aDressType); listViewRowNo = 0; } System.Text.StringBuilder strbuilder = new System.Text.StringBuilder(); strbuilder.Append("<script type = 'text/javascript'>"); strbuilder.Append("window.onload=function(){"); strbuilder.Append("alert('"); strbuilder.Append(Savemsg); strbuilder.Append("')};"); strbuilder.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", strbuilder.ToString()); ClearAllField(); LoadDressTypeListview(); }
public void SetItemType(int id) { ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(id); objectType = info.type; dressType = info.dressType; }
public Dress(string name, string producer, string material, double price, DressType type, string color, double length) : base(name, producer, material, price) { Color = color; Type = type; Length = length; }
private void populateTreeButton_Click(object sender, EventArgs e) { DressTypeManager aDressTypeManager = new DressTypeManager(); DressType aDressType = new DressType(); dressMeasurementTreeView.Nodes.Add(aDressTypeManager.GetAll().ToString()); }
public int Edit(int id, DressTypeModel ObjDressTypeModel) { try { if (id > 0) { if (ObjDressTypeModel != null) { DressType ObjDressType = DBContext.DressTypes.Where(a => a.DressType_ID == id).FirstOrDefault(); if (ObjDressType != null) { //DressTypeModel Edit Properties mapping here. //ObjDressType.Profile_Name = ObjDressTypeModel.Profile_Name; //ObjDressType.Password = ObjDressTypeModel.Password; //ObjDressType.First_Name = ObjDressTypeModel.First_Name; //ObjDressType.Middle_Name = ObjDressTypeModel.Middle_Name; //ObjDressType.Last_Name = ObjDressTypeModel.Last_Name; //ObjDressType.Email_Address = ObjDressTypeModel.Email_Address; //ObjDressType.Contact_Number = ObjDressTypeModel.Contact_Number; //ObjDressType.Cell_Number = ObjDressTypeModel.Cell_Number; //ObjDressType.Location_ID = ObjDressTypeModel.Location_ID; //ObjDressType.PickUp_Address = ObjDressTypeModel.PickUp_Address; //ObjDressType.Drop_Address = ObjDressTypeModel.Drop_Address; //ObjDressType.QR_Code = ObjDressTypeModel.QR_Code; //ObjDressType.Rating = ObjDressTypeModel.Rating; //ObjDressType.Created_DateTime = ObjDressTypeModel.Created_DateTime; //ObjDressType.Created_By = ObjDressTypeModel.Created_By; //ObjDressType.Modified_DateTime = ObjDressTypeModel.Modified_DateTime; //ObjDressType.Modified_By = ObjDressTypeModel.Modified_By; //ObjDressType.Deleted = ObjDressTypeModel.Deleted; DBContext.SubmitChanges(); return(ObjDressType.DressType_ID); } else { return(WebApiResponse.NoRecordFound); } } else { return(WebApiResponse.InputObjectIsNull); } } else { return(WebApiResponse.InputIdInvalid); } } catch (Exception ex) { throw ex; } }
public void SetIconName(int id, string icon_name) { sprite.spriteName = icon_name; this.id = id; ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(id); objectType = info.type; if (info.type == ObjectType.Equip) { dressType = info.dressType; } }
public int Create(DressType ObjDressType) { try { DBContext.DressTypes.InsertOnSubmit(ObjDressType); DBContext.SubmitChanges(); return(ObjDressType.DressType_ID); } catch (Exception ex) { throw ex; } }
/// <summary> /// 构造函数:装备 /// </summary> /// <param name="id">物品ID</param> /// <param name="name">物品名称</param> /// <param name="iconName">图片文件名</param> /// <param name="type">物品类型</param> /// <param name="attack">加伤害值</param> /// <param name="def">加防御值</param> /// <param name="speed">加速度值</param> /// <param name="dressType">穿戴类型</param> /// <param name="applicationType">适用类型</param> /// <param name="sell">出售价</param> /// <param name="buy">购买价</param> public ObjectInfo(int id, string name, string iconName, ObjectType type, int attack, int def, int speed, DressType dressType, ApplicationType applicationType, int sell, int buy) { this.id = id; this.name = name; this.iconName = iconName; this.type = type; this.attack = attack; this.def = def; this.speed = speed; this.dressType = dressType; this.applicationType = applicationType; this.priceSell = sell; this.priceBuy = buy; }
public void SetEquipUI(DressType dt, int id) { foreach (MyEquipItem et in equipLsit) { if (et.dresstype == dt) { if (et.id != 0) { InventoryList._instance.FillInBag(et.id, 1); PlayerState.instance.Takeoff(et.it.plusMaxHP, et.it.plusMaxMP, et.it.plusStr, et.it.plusDef, et.it.plusAgi, et.it.plusCrit); } et.SetEquipItemUI(id); } } }
public List <Model.DressType> GetAll() { string query = "SELECT * FROM DressTypeTable"; SqlConnection sqlConnection = new SqlConnection(connection.ConnectionString); sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(query, sqlConnection); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); List <DressType> dressTypes = new List <DressType>(); while (sqlDataReader.Read()) { DressType aDressType = new DressType(); aDressType.Name = sqlDataReader[1].ToString(); dressTypes.Add(aDressType); } sqlConnection.Close(); return(dressTypes); }
private void addButton_Click(object sender, EventArgs e) { DressType aDressType = new DressType(); aDressType.Name = nameTextBox.Text; aDressType.TailoringRate = Convert.ToDouble(tailoringRateTextBox.Text); aDressType.SticherRate = Convert.ToDouble(sticherRateTextBox.Text); aDressType.CutterRate = Convert.ToDouble(cutterRateTextBox.Text); DressTypeManager aDressTypeManager = new DressTypeManager(); if (aDressTypeManager.SaveAll(aDressType)) { MessageBox.Show("Dress Type Added Successfully"); } else { MessageBox.Show("Error Adding Dress Type"); } }
public int Delete(int id, DressTypeModel ObjInputDressTypeModel) { try { //Just keep ObjInputDressTypeModel as parameter for Deleted Log. DressType ObjDressType = DBContext.DressTypes.Where(a => a.DressType_ID == id).FirstOrDefault(); if (ObjDressType != null) { DBContext.DressTypes.DeleteOnSubmit(ObjDressType); DBContext.SubmitChanges(); return(ObjDressType.DressType_ID); } else { return(0); } } catch (Exception ex) { throw ex; } }
protected void lvAllDressType_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem currentItem = (ListViewDataItem)e.Item; DressType dressType = (DressType)((ListViewDataItem)(e.Item)).DataItem; Label lblDressType = (Label)currentItem.FindControl("lblDressType"); Label lblDressPrice = (Label)currentItem.FindControl("lblDressPrice"); LinkButton lnkEdit = (LinkButton)currentItem.FindControl("lnkEdit"); //listViewRowNo = 0; listViewRowNo += 1; Label lblSerialNo = (Label)currentItem.FindControl("lblSerialNo"); //lblSerialNo.Text = listViewRowNo.ToString(); lblDressType.Text = dressType.TypeName; lblDressPrice.Text = dressType.DressPrice.ToString(); lnkEdit.CommandArgument = dressType.DressTypeID.ToString(); lnkEdit.CommandName = "EditDressType"; } }
public void SetInfo(ObjectsInfo info) { this.id = info.id; sprite.spriteName = info.icon_name; dressType = info.dressType; }
/// <summary> /// 读取配置文件信息,根据内容生成对象,保存到字典 /// </summary> void ReadInfo() { string text = objectsInfoListText.text; string[] strArray = text.Split('\n'); ObjectInfo info = null; ObjectType type = ObjectType.Drug; DressType dressType = DressType.Accessory; ApplicationType applicationType = ApplicationType.Common; foreach (string str in strArray) { string[] proArray = str.Split(','); switch (proArray[3]) { case "Drug": type = ObjectType.Drug; break; case "Equip": type = ObjectType.Equip; break; case "Mat": type = ObjectType.Mat; break; } if (type == ObjectType.Drug) { info = new ObjectInfo(int.Parse(proArray[0]), proArray[1], proArray[2], type, int.Parse(proArray[4]), int.Parse(proArray[5]), int.Parse(proArray[6]), int.Parse(proArray[7])); //objectInfoDict.Add(int.Parse(proArray[0]), info); } else if (type == ObjectType.Equip) { string strDressType = proArray[7]; string strApplicationType = proArray[8]; switch (strDressType) { case "Headgear": dressType = DressType.Headgear; break; case "Armor": dressType = DressType.Armor; break; case "LeftHand": dressType = DressType.LeftHand; break; case "RightHand": dressType = DressType.RightHand; break; case "Shoe": dressType = DressType.Shoe; break; case "Accessory": dressType = DressType.Accessory; break; } switch (strApplicationType) { case "Swordman": applicationType = ApplicationType.Swordman; break; case "Magician": applicationType = ApplicationType.Magician; break; case "Common": applicationType = ApplicationType.Common; break; } info = new ObjectInfo(int.Parse(proArray[0]), proArray[1], proArray[2], type, int.Parse(proArray[4]), int.Parse(proArray[5]), int.Parse(proArray[6]), dressType, applicationType, int.Parse(proArray[9]), int.Parse(proArray[10])); } objectInfoDict.Add(int.Parse(proArray[0]), info); } }
public void ReadInfo(TextAsset objectsInfoListText) { //获取文本中的字符串 string text = objectsInfoListText.text; string[] strArray = text.Split('\n'); foreach (string str in strArray) { string[] proArray = str.Split(','); ObjectInfo info = new ObjectInfo(); int id = int.Parse(proArray[0]); string name = proArray[1]; string icon_name = proArray[2]; string str_type = proArray[3]; info.id = id; info.name = name; info.icon_name = icon_name; ObjectType type = ObjectType.Drug; switch (str_type) { case "Drug": type = ObjectType.Drug; break; case "Equip": type = ObjectType.Equip; break; case "Mat": type = ObjectType.Mat; break; } info.type = type; if (type == ObjectType.Drug) { int hp = int.Parse(proArray[4]); int mp = int.Parse(proArray[5]); int price_sell = int.Parse(proArray[6]); int price_buy = int.Parse(proArray[7]); info.hp = hp; info.mp = mp; info.price_sell = price_sell; info.price_buy = price_buy; } else if (type == ObjectType.Equip) { int attack = int.Parse(proArray[4]); int def = int.Parse(proArray[5]); int speed = int.Parse(proArray[6]); int price_sell = int.Parse(proArray[9]); int price_buy = int.Parse(proArray[10]); string str_dressType = proArray[7]; DressType dressType = DressType.Headgear; switch (str_dressType) { case "Headgear": dressType = DressType.Headgear; break; case "Armor": dressType = DressType.Armor; break; case "RightHand": dressType = DressType.RightHand; break; case "LeftHand": dressType = DressType.LeftHand; break; case "Shoe": dressType = DressType.Shoe; break; case "Accessory": dressType = DressType.Accessory; break; } string str_applicationType = proArray[8]; ApplicationType applicationType = ApplicationType.Swordman; switch (str_applicationType) { case "Swordman": applicationType = ApplicationType.Swordman; break; case "Magician": applicationType = ApplicationType.Magician; break; case "Common": applicationType = ApplicationType.Common; break; } info.attack = attack; info.def = def; info.speed = speed; info.price_buy = price_buy; info.price_sell = price_sell; info.dressType = dressType; info.applicationType = applicationType; } //向字典中添加一个objectInfo实例 objectInfoDict.Add(id, info); } }
public string UpdateDressType(DressType aDressType, int DressTypeID) { return(tailorGateway.UpdateDressType(aDressType, DressTypeID)); }
public string SaveDressType(DressType aDressType) { return(tailorGateway.SaveDressType(aDressType)); }