public Form_ARRec_Demo() { InitializeComponent(); // cReadinData obj_readData = new cReadinData(0); sourceUsers = cReadinData.getBaseUser(); // 读入训练数据 testUsers = cReadinData.getTestUser(); // 读入测试数据 supp_AssRules = new AssociationRule[sourceUsers.Length][]; recItems = new RecItemid_Degree[sourceUsers.Length][]; dataGridView1.RowHeadersVisible = false; dataGridView2.RowHeadersVisible = false; dataGridView3.RowHeadersVisible = false; cItem obj = new cItem(); objs_movieInfo = cItem.movies; for (int i = 1; i < testUsers.Length; i++) { int userid = testUsers[i].id; this.comboBox1.Items.Add(userid); } this.comboBox1.SelectedIndex = 0; }
public static void GetItemInfo(out cItem pItem, int pItemNum) { switch (pItemNum) { // 소비 (0 ~ 10) case 0: pItem = new cItem_Potion_hp("HP 포션", "주인공의 체력을 5초동안 25% 회복시킨다.", new cProperty("Price", 1000), 1, (byte)pItemNum); return; case 1: pItem = new cItem_Torch("횃불", "던전 벽에 고정시켜 주변을 밝힐 수 있는 일반적인 횃불이다.", new cProperty("Price", 1000), 1, (byte)pItemNum); return; case 2: pItem = new cItem_Bomb("다이너마이트", "전방으로 투척하여 사용한다. 폭발반경은 3X3타일이다.", new cProperty("Price", 1000), 1, (byte)pItemNum); return; // 재료(50 ~ 100) case 50: pItem = new cItem_etc("수상한 등불", "수상한 동굴을 탐험할 수 있도록 주변의 강한 기운을 밝혀주는 등불이다.", new cProperty("price", 0), 1, (byte)pItemNum); return; } pItem = null; }
private void InitcboItem() { cItem oItem = new cItem(); string strMessage = string.Empty, strCriteria = string.Empty; string strItem_code = string.Empty; string strItem_group_detail_id = string.Empty; string strYear = cboYear.SelectedValue; strItem_code = cboItem.SelectedValue; strItem_group_detail_id = cboItem_group_detail.SelectedValue; DataSet ds = new DataSet(); DataTable dt = new DataTable(); strCriteria = " and Item_year = '" + strYear + "' and c_active='Y' "; if (!string.IsNullOrEmpty(strItem_group_detail_id)) { strCriteria += " and item_group_detail_id = '" + strItem_group_detail_id + "' "; } if (oItem.SP_ITEM_SEL(strCriteria, ref ds, ref strMessage)) { dt = ds.Tables[0]; cboItem.Items.Clear(); cboItem.Items.Add(new ListItem("---- กรุณาเลือกข้อมูล ----", "")); int i; for (i = 0; i <= dt.Rows.Count - 1; i++) { cboItem.Items.Add(new ListItem(dt.Rows[i]["Item_name"].ToString(), dt.Rows[i]["Item_code"].ToString())); } if (cboItem.Items.FindByValue(strItem_code) != null) { cboItem.SelectedIndex = -1; cboItem.Items.FindByValue(strItem_code).Selected = true; } } }
public async void cItemSelected(object sender, EventArgs args) { ListView lv = (ListView)sender; cItem c = lv.SelectedItem as cItem; if (c == null) { return; } if (!cMultiSelect.IsToggled) { await Navigation.PushAsync(new ContactDetailPage(c.cId), false); } else { int index = clist.IndexOf(c); // ObservableCollection does not raise propertychanged event when only updating the content of the item // remove the item then add it back, to generate the property change event from the observablecollection clist.Remove(c); c.cChecked = !c.cChecked; clist.Insert(index, c); ((ListView)sender).SelectedItem = null; } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strMessage = string.Empty; string strCheck = string.Empty; string strScript = string.Empty; string strUpdatedBy = Session["username"].ToString(); Label lblitem_code = (Label)GridView1.Rows[e.RowIndex].FindControl("lblitem_code"); cItem oItem = new cItem(); try { if (!oItem.SP_ITEM_DEL(lblitem_code.Text, "N", strUpdatedBy, ref strMessage)) { lblError.Text = strMessage; } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oItem.Dispose(); } BindGridView(0); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strMessage = string.Empty; string strCheck = string.Empty; string strScript = string.Empty; string strUpdatedBy = Session["username"].ToString(); Label lblitem_code = (Label)GridView1.Rows[e.RowIndex].FindControl("lblitem_code"); cItem oItem = new cItem(); try { oItem.SP_ITEM_DEL(lblitem_code.Text); } catch (Exception ex) { if (ex.Message.Contains(" REFERENCE constraint")) { MsgBox("ไม่สามารถลบข้อมูลได้เนื่องจากมีการนำไปใช้ในระบบแล้ว"); } else { lblError.Text = ex.Message.ToString(); } } finally { oItem.Dispose(); } BindGridView(0); }
private void ZExists(int pMessageCount, cTrace.cContext pParentContext) { var lContext = pParentContext.NewMethod(nameof(cSelectedMailboxCache), nameof(ZExists), pMessageCount); if (pMessageCount < mItems.Count) { throw new cUnexpectedServerActionException(0, "count should only go up", lContext); } int lToAdd = pMessageCount - mItems.Count; cMessageHandleList lMessageHandles = new cMessageHandleList(); for (int i = 0; i < lToAdd; i++) { cItem lItem = new cItem(this, mCacheSequence++); mItems.Add(lItem); lMessageHandles.Add(lItem); } mUIDNextUnknownCount += lToAdd; mUnseenUnknownCount += lToAdd; mSynchroniser.InvokeMailboxMessageDelivery(mMailboxCacheItem, lMessageHandles, lContext); ZSetMailboxStatus(lContext); }
//골드, 캐쉬, 공격력, 체력, 스피드돌진, 폭탄, 총알UP //몬스터 한테서는 캐쉬와 골드가 떨어진다. static public cItem MakeItem(string _itemName) { switch (_itemName) { case "아이템_골드": returnItem = new cItem_Gold(); returnItem.m_name = "아이템_골드"; returnItem.m_goldPrice = 5; break; case "아이템_캐쉬": returnItem = new cItem_Cash(); returnItem.m_name = "아이템_캐쉬"; returnItem.m_cashPrice = 10; break; case "아이템_공격력": returnItem = new cItem_Passive_Attack(); returnItem.m_name = "아이템_공격력"; returnItem.m_cashPrice = 50; break; case "아이템_체력": returnItem = new cItem_Passive_HpUp(); returnItem.m_name = "아이템_체력"; returnItem.m_cashPrice = 50; break; case "아이템_스피드돌진": returnItem = new cItem_Active_Speed(); returnItem.m_name = "아이템_스피드돌진"; returnItem.m_goldPrice = 100; break; case "아이템_자석": returnItem = new cItem_Active_Magnet(); returnItem.m_name = "아이템_자석"; returnItem.m_goldPrice = 100; break; case "아이템_총알": returnItem = new cItem_Active_Bullet(); returnItem.m_name = "아이템_총알"; returnItem.m_goldPrice = 100; break; } if (returnItem != null) { cItem outItem = returnItem; returnItem = null; return(outItem); } else { returnItem = null; return(null); } }
public void TestOrderSingleItem() { PurchaseOrder order = new PurchaseOrder(); cItem item = new cItem("A100", 50.5); order.AddItem(item); Assert.IsTrue(order.GetOrders().Count == 1); }
public void SetData(cItem _itemInfo, int _index) { m_index = _index; string tmpName = _itemInfo.m_name.Remove(0, 4); m_label.text = "[" + tmpName + "]"; m_texture.mainTexture = Resources.Load(cItem_Factory.MakePath(_itemInfo.m_name)) as Texture; }
// Constructor public cDatabase() { for (int i = 0; i < 256; i++) { unit[i] = new cUnit(); item[i] = new cItem(); uiElement[i] = new cUIElement(); } }
private bool saveData() { bool blnResult = false; string strScript = string.Empty; cItem oItem = new cItem(); DataSet ds = new DataSet(); try { #region set Data var item = new Item() { item_code = txtitem_code.Text.Trim(), item_name = txtitem_name.Text, item_year = cboYear.SelectedItem.Value, item_group_detail_id = int.Parse(cboItem_group_detail.SelectedItem.Value), c_active = chkStatus.Checked ? "Y" : "N", c_created_by = Session["username"].ToString(), c_updated_by = Session["username"].ToString() }; #endregion if (ViewState["mode"].ToString().ToLower().Equals("edit")) { oItem.SP_ITEM_UPD(item); } else { oItem.SP_ITEM_INS(item); } blnResult = true; } catch (Exception ex) { if (ex.Message.Contains("duplicate key")) { strScript = @"ไม่สามารถแก้ไขข้อมูลได้ เนื่องจาก"; //if (ex.Message.Contains("IX_item_group_detail_code")) //{ // strScript += "ข้อมูลรหัสรายละเอียดหมวดค่าใช้จ่าย : " + txtitem_group_detail_code.Text + " ซ้ำ"; //} //else if (ex.Message.Contains("IX_item_group_detail_name")) //{ // strScript += "ข้อมูลรายละเอียดหมวดค่าใช้จ่าย : " + txtitem_group_detail_name.Text + " ซ้ำ"; //} MsgBox(strScript); } else { lblError.Text = ex.Message.ToString(); } } finally { oItem.Dispose(); } return(blnResult); }
private void setData() { cItem oItem = new cItem(); string strMessage = string.Empty, strCriteria = string.Empty; try { strCriteria = " and item_code = '" + ViewState["item_code"].ToString() + "' "; var item = oItem.GET(strCriteria); if (item != null) { #region set Control InitcboYear(); if (cboYear.Items.FindByValue(item.item_year) != null) { cboYear.SelectedIndex = -1; cboYear.Items.FindByValue(item.item_year).Selected = true; } cboYear.Enabled = false; txtitem_code.Text = item.item_code; txtitem_name.Text = item.item_name; if (cboItem_type.Items.FindByValue(item.item_group_type) != null) { cboItem_type.SelectedIndex = -1; cboItem_type.Items.FindByValue(item.item_group_type).Selected = true; } InitcboItem_group(); if (cboItem_group.Items.FindByValue(item.item_group_code) != null) { cboItem_group.SelectedIndex = -1; cboItem_group.Items.FindByValue(item.item_group_code).Selected = true; } InitcboItemGroupDetail(); if (cboItem_group_detail.Items.FindByValue(item.item_group_detail_id.ToString()) != null) { cboItem_group_detail.SelectedIndex = -1; cboItem_group_detail.Items.FindByValue(item.item_group_detail_id.ToString()).Selected = true; } chkStatus.Checked = item.c_active == "Y"; cboYear.CssClass = "textboxdis"; txtitem_code.ReadOnly = true; txtitem_code.CssClass = "textboxdis"; txtUpdatedBy.Text = item.c_updated_by; txtUpdatedDate.Text = item.d_updated_date.ToString(); #endregion } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } }
public void SetupSlot(cItem item = null) { if (item == null) { itemInSlot.SetActive(false); return; } slotItem = item; slotImage.sprite = item.itemSprite; slotNum.text = item.itemHeldNumber.ToString(); }
public void TestItemFinalPrice() { cItem item = new cItem("A100", 10); PurchaseOrder poList = new PurchaseOrder(); poList.AddItem(item); var mDiscountEngine = new Mock <IDiscountEngine>(); mDiscountEngine.Setup((p) => p.Compute(ref poList)); }
public void Sell() { //여기서 돈 조건 따져야함 돈이 조건이 충분하다면 //AddByShopToInventory실행! //부족하다면 돈이 부족합니다 팝업창 실행! cItem selectItem = cItem_Factory.MakeItem(m_itemName); if (m_itemName.Equals("아이템_공격력") || m_itemName.Equals("아이템_체력")) { //돈이 모자라다면 if (cDataManager.INSTANCE.PLAYER.m_Cash < selectItem.m_cashPrice) { MakePrefabNotify("금액이 부족합니다."); } else { cDataManager.INSTANCE.PLAYER.m_Cash -= selectItem.m_cashPrice; if (m_itemName.Equals("아이템_공격력")) { MakePrefabNotify("[ 구매완료 ]" + "\n\n" + m_itemName.Remove(0, 4) + " : " + cDataManager.INSTANCE.PLAYER.m_Attack.ToString() + " → " + (cDataManager.INSTANCE.PLAYER.m_Attack + cItem_Factory.MakeItem(m_itemName).ItemDataOut()).ToString() + "\n 증가 되었습니다."); } else if (m_itemName.Equals("아이템_체력")) { MakePrefabNotify("[ 구매완료 ]" + "\n\n" + m_itemName.Remove(0, 4) + " : " + cDataManager.INSTANCE.PLAYER.m_hp.ToString() + " → " + (cDataManager.INSTANCE.PLAYER.m_hp + cItem_Factory.MakeItem(m_itemName).ItemDataOut()).ToString() + "\n 증가 되었습니다."); } cItem_Factory.MakeItem(m_itemName).Use(); cDataManager.INSTANCE.PLAYER.Notify(); } } else { //돈이 모자라다면 if (cDataManager.INSTANCE.PLAYER.m_GameMoney < selectItem.m_goldPrice) { MakePrefabNotify("금액이 부족합니다."); } else { cDataManager.INSTANCE.PLAYER.m_GameMoney -= selectItem.m_goldPrice; m_Inventory.AddByShopToInventory(m_itemName); cDataManager.INSTANCE.PLAYER.Notify(); MakePrefabNotify("구매가 완료되었습니다."); } } FadeOut(); }
public void Setting(string _itemName) { Init(100.0f, 2.0f, 25.0f); m_camera = new cCheckOutCamera(gameObject); m_item = cItem_Factory.MakeItem(_itemName); GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(cItem_Factory.MakePath(_itemName)); transform.localScale = new Vector3(0.05f, 0.05f, 0.05f); m_radNormalVec = (float)UnityEngine.Random.Range(-1, 2); m_radNormalVec2 = (float)UnityEngine.Random.Range(0.5f, 2); m_direction = 1; m_graity = 0.0f; m_isMagnet = false; }
public void ShowContacts(List <QContact> qcs) { if (qcs != null) { clist.Clear(); foreach (QContact qc in qcs) { cItem c = new cItem(); //for test c.cSource = "http://graph.facebook.com/" + qc.myIdfriendId.Split(',')[1] + "/picture?type=small"; c.cName = qc.FirstName + " " + qc.LastName; c.cId = qc.myIdfriendId; c.cChecked = false; clist.Add(c); } } }
private void InitcboItem() { cItem oItem = new cItem(); string strMessage = string.Empty, strCriteria = string.Empty; string strItem_code = string.Empty; string strItem_group_detail_id = string.Empty; var strYear = string.Empty; if (this.BudgetType == "B") { strYear = ((DataSet)Application["xmlconfig"]).Tables["default"].Rows[0]["yearnow"].ToString(); } else { strYear = ((DataSet)Application["xmlconfig"]).Tables["default"].Rows[0]["yearnow2"].ToString(); } strItem_code = cboItem.SelectedValue; strItem_group_detail_id = cboItem_group_detail.SelectedValue; DataSet ds = new DataSet(); DataTable dt = new DataTable(); strCriteria = " and Item_year = '" + strYear + "' and c_active='Y' "; if (!string.IsNullOrEmpty(strItem_group_detail_id)) { strCriteria += " and item_group_detail_id = '" + strItem_group_detail_id + "' "; } if (oItem.SP_ITEM_SEL(strCriteria, ref ds, ref strMessage)) { dt = ds.Tables[0]; cboItem.Items.Clear(); cboItem.Items.Add(new ListItem("---- เลือกข้อมูลทั้งหมด ----", "")); int i; for (i = 0; i <= dt.Rows.Count - 1; i++) { cboItem.Items.Add(new ListItem(dt.Rows[i]["Item_name"].ToString(), dt.Rows[i]["Item_code"].ToString())); } if (cboItem.Items.FindByValue(strItem_code) != null) { cboItem.SelectedIndex = -1; cboItem.Items.FindByValue(strItem_code).Selected = true; } } }
public Form_AssociationRules() { InitializeComponent(); association_Rules = cApriori.association_Rules; AssociationRule obj; // 得到电影信息 cItem obj_item = new cItem(); objs_movieInfo = cItem.movies; dataGridView1.RowHeadersVisible = false; // 填充dataGridView1 for (int count = 0; count < association_Rules.Count; count++) { // 取得每个关联规则信息 obj = (AssociationRule)association_Rules[count]; this.dataGridView1.Rows.Add(count + 1, objs_movieInfo[obj._itemid_1].name, objs_movieInfo[obj._itemid_2].name, obj.Support, obj.confidence); } }
public override bool LoadXML() { if (File.Exists(Application.persistentDataPath + "/xmlInventory.xml")) { string text = File.ReadAllText(Application.persistentDataPath + "/xmlInventory.xml"); if (text == null) { return(false); } XmlDocument m_xmlDocument = new XmlDocument(); m_xmlDocument.LoadXml(text); XmlNodeList rootNode = m_xmlDocument.SelectNodes(nodeStr[0]); foreach (XmlNode childNode in rootNode) { cItem tmpItem = cItem_Factory.MakeItem(childNode[nodeStr[1]].InnerText); m_inventoryList.Add(tmpItem); } } else { TextAsset ta = Resources.Load("xmlInventory", typeof(TextAsset)) as TextAsset; if (ta == null) { return(false); } XmlDocument m_xmlDocument = new XmlDocument(); m_xmlDocument.LoadXml(ta.text); XmlNodeList rootNode = m_xmlDocument.SelectNodes(nodeStr[0]); foreach (XmlNode childNode in rootNode) { cItem tmpItem = cItem_Factory.MakeItem(childNode[nodeStr[1]].InnerText); m_inventoryList.Add(tmpItem); } } return(true); }
private void BindGridView() { cItem oItem = new cItem(); DataSet ds = new DataSet(); string strMessage = string.Empty; string strCriteria = string.Empty; string stritem_year = string.Empty; string stritem_code = string.Empty; string stritem_name = string.Empty; string stritem_type = string.Empty; string stritem_group_code = string.Empty; string stritem_group_name = string.Empty; string strlot_name = string.Empty; string strperson_group_code = string.Empty; string strperson_code = string.Empty; string strScript = string.Empty; stritem_year = txtyear.Text.Replace("'", "''").Trim(); stritem_code = txtitem_code.Text.Replace("'", "''").Trim(); stritem_name = txtitem_name.Text.Replace("'", "''").Trim(); stritem_type = cboItem_type.SelectedValue; strperson_group_code = cboPerson_group.SelectedItem.Value; strperson_code = ViewState["person_code"].ToString(); if (!stritem_year.Equals("")) { strCriteria = strCriteria + " And (item_year = '" + stritem_year + "') "; } if (!stritem_code.Equals("")) { strCriteria = strCriteria + " And (item_code like '%" + stritem_code + "%') "; } if (!stritem_name.Equals("")) { strCriteria = strCriteria + " And (item_name like '%" + stritem_name + "%') "; } if (!stritem_group_code.Equals("")) { strCriteria = strCriteria + " And (item_group_code like '%" + stritem_group_code + "%') "; } if (!stritem_group_name.Equals("")) { strCriteria = strCriteria + " And (item_group_name like '%" + stritem_group_name + "%') "; } //if (!strperson_group_code.Equals("")) //{ // strCriteria = strCriteria + " And (person_group_code ='" + strperson_group_code + "' Or person_group_code='') "; //} if (!strperson_code.Equals("")) { if (!stritem_type.Equals("")) { strCriteria = strCriteria + " And (item_type = '" + stritem_type + "' OR substring(item_code,5,7) in ('09-001','09-100') ) "; } strCriteria = strCriteria + " And (substring(item_code,5,7)<>'03-002' OR (substring(item_code,5,7) in ('09-001','09-100')))"; if (ViewState["payment_back_type"].ToString().Equals("O")) { strCriteria = strCriteria + " And substring(item_code,5,7) in(Select substring(item_code,5,7) from view_payment_debit where person_code ='" + strperson_code + "' ) "; } else if (ViewState["payment_back_type"].ToString().Equals("N")) { strCriteria = strCriteria + " And (person_group_code in(Select person_group_code from person_work where person_code ='" + strperson_code + "') or person_group_code ='') "; } strCriteria = strCriteria + " And (person_group_code in (Select person_group_code from person_work Where person_code='" + strperson_code + "') Or person_group_code='') "; } else { if (!stritem_type.Equals("")) { strCriteria = strCriteria + " And (item_type = '" + stritem_type + "') "; } } strCriteria = strCriteria + " And (c_active ='Y') "; //if (DirectorLock == "N") //{ // strCriteria += " and lot_code in (''," + LotCodeList + ") "; //} try { if (oItem.SP_ITEM_SEL(strCriteria, ref ds, ref strMessage)) { if (ds.Tables[0].Rows.Count == 1) { stritem_code = ds.Tables[0].Rows[0]["item_code"].ToString(); stritem_name = ds.Tables[0].Rows[0]["item_name"].ToString(); stritem_type = ds.Tables[0].Rows[0]["item_type"].ToString(); stritem_group_name = ds.Tables[0].Rows[0]["item_group_name"].ToString(); strlot_name = ds.Tables[0].Rows[0]["lot_name"].ToString(); if (stritem_type.Equals("D")) { stritem_type = "Debit"; } else { stritem_type = "Credit"; } stritem_name = ds.Tables[0].Rows[0]["item_name"].ToString(); if (!ViewState["show"].ToString().Equals("1")) { if (ViewState["from"].ToString().Equals("member")) { strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n " + "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n" + "ClosePopUp('" + ViewState["show"].ToString() + "');"; } else if (ViewState["from"].ToString().Equals("back")) { strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n " + "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n" + "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].__doPostBack('ctl00$ContentPlaceHolder1$BtnR1','');" + "ClosePopUp('" + ViewState["show"].ToString() + "');"; } else { //strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n " + // "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n" + // "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl3"].ToString() + "').value='" + stritem_type + "';\n" + // "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl4"].ToString() + "').value='" + stritem_group_name + "';\n" + // "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl5"].ToString() + "').value='" + strlot_name + "';\n" + // "ClosePopUp('" + ViewState["show"].ToString() + "');"; if (!string.IsNullOrEmpty(ViewState["ctrl1"].ToString())) { strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n "; } if (!string.IsNullOrEmpty(ViewState["ctrl2"].ToString())) { strScript += "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n"; } if (!string.IsNullOrEmpty(ViewState["ctrl2"].ToString())) { strScript += "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl3"].ToString() + "').value='" + stritem_type + "';\n"; } if (!string.IsNullOrEmpty(ViewState["ctrl2"].ToString())) { strScript += "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl4"].ToString() + "').value='" + stritem_group_name + "';\n"; } if (!string.IsNullOrEmpty(ViewState["ctrl2"].ToString())) { strScript += "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl5"].ToString() + "').value='" + strlot_name + "';\n"; } strScript += "ClosePopUp('" + ViewState["show"].ToString() + "');"; } } else { strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n " + "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n" + "window.parent.document.getElementById('" + ViewState["ctrl3"].ToString() + "').value='" + stritem_type + "';\n" + "window.parent.document.getElementById('" + ViewState["ctrl4"].ToString() + "').value='" + stritem_group_name + "';\n" + "window.parent.document.getElementById('" + ViewState["ctrl5"].ToString() + "').value='" + strlot_name + "';\n" + "ClosePopUp('" + ViewState["show"].ToString() + "');"; if (ViewState["from"].ToString().Equals("member") | ViewState["from"].ToString().Equals("report")) { strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + stritem_code + "';\n " + "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + stritem_name + "';\n" + "ClosePopUp('" + ViewState["show"].ToString() + "');"; } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", strScript, true); } else { ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"]; GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } else { lblError.Text = strMessage; } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oItem.Dispose(); ds.Dispose(); } }
private void setData() { cItem oItem = new cItem(); DataSet ds = new DataSet(); string strMessage = string.Empty, strCriteria = string.Empty; string stritem_code = string.Empty, stritem_name = string.Empty, stritem_year = string.Empty, stritem_type = string.Empty, stritem_group_code = string.Empty, stritem_group_name = string.Empty, strlot_code = string.Empty, strlot_name = string.Empty, strperson_group_code = string.Empty, strYear = string.Empty, strC_active = string.Empty, strCreatedBy = string.Empty, strUpdatedBy = string.Empty, strCreatedDate = string.Empty, strUpdatedDate = string.Empty, strcheque_code = string.Empty, strcheque_name = string.Empty, strcheque_type = string.Empty, stritem_acc_code = string.Empty, stritem_project_code1 = string.Empty, stritem_project_code2 = string.Empty; try { strCriteria = " and item_code = '" + ViewState["item_code"].ToString() + "' "; if (!oItem.SP_ITEM_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { #region get Data strYear = ds.Tables[0].Rows[0]["item_year"].ToString(); stritem_code = ds.Tables[0].Rows[0]["item_code"].ToString(); stritem_name = ds.Tables[0].Rows[0]["item_name"].ToString(); stritem_type = ds.Tables[0].Rows[0]["item_type"].ToString(); stritem_group_code = ds.Tables[0].Rows[0]["item_group_code"].ToString(); stritem_group_name = ds.Tables[0].Rows[0]["item_group_name"].ToString(); strlot_code = ds.Tables[0].Rows[0]["lot_code"].ToString(); strlot_name = ds.Tables[0].Rows[0]["lot_name"].ToString(); strperson_group_code = ds.Tables[0].Rows[0]["person_group_code"].ToString(); strC_active = ds.Tables[0].Rows[0]["c_active"].ToString(); strCreatedBy = ds.Tables[0].Rows[0]["c_created_by"].ToString(); strUpdatedBy = ds.Tables[0].Rows[0]["c_updated_by"].ToString(); strCreatedDate = ds.Tables[0].Rows[0]["d_created_date"].ToString(); strUpdatedDate = ds.Tables[0].Rows[0]["d_updated_date"].ToString(); strcheque_code = ds.Tables[0].Rows[0]["cheque_code"].ToString(); strcheque_name = ds.Tables[0].Rows[0]["cheque_name"].ToString(); strcheque_type = ds.Tables[0].Rows[0]["cheque_type"].ToString(); stritem_acc_code = ds.Tables[0].Rows[0]["item_acc_id"].ToString(); stritem_project_code1 = ds.Tables[0].Rows[0]["item_project_code1"].ToString(); stritem_project_code2 = ds.Tables[0].Rows[0]["item_project_code2"].ToString(); #endregion #region set Control InitcboYear(); if (cboYear.Items.FindByValue(strYear) != null) { cboYear.SelectedIndex = -1; cboYear.Items.FindByValue(strYear).Selected = true; } cboYear.Enabled = false; txtitem_code.Text = stritem_code; txtitem_name.Text = stritem_name; txtitem_project_code1.Text = stritem_project_code1; txtitem_project_code2.Text = stritem_project_code2; if (cboItem_type.Items.FindByValue(stritem_type) != null) { cboItem_type.SelectedIndex = -1; cboItem_type.Items.FindByValue(stritem_type).Selected = true; } InitcboPerson_group(); if (cboPerson_group.Items.FindByValue(strperson_group_code) != null) { cboPerson_group.SelectedIndex = -1; cboPerson_group.Items.FindByValue(strperson_group_code).Selected = true; } txtcheque_code.Text = strcheque_code; txtcheque_name.Text = strcheque_name; if (cboCheque_type.Items.FindByValue(strcheque_type) != null) { cboCheque_type.SelectedIndex = -1; cboCheque_type.Items.FindByValue(strcheque_type).Selected = true; } InitcboItem_acc(); if (cboItem_acc.Items.FindByValue(stritem_acc_code) != null) { cboItem_acc.SelectedIndex = -1; cboItem_acc.Items.FindByValue(stritem_acc_code).Selected = true; } string strBudget_type = ds.Tables[0].Rows[0]["budget_type"].ToString(); InitcboBudgetType(); if (cboBudget_type.Items.FindByValue(strBudget_type) != null) { cboBudget_type.SelectedIndex = -1; cboBudget_type.Items.FindByValue(strBudget_type).Selected = true; } txtdirect_pay_code.Text = ds.Tables[0].Rows[0]["direct_pay_code"].ToString(); if (strC_active.Equals("Y")) { cboItem_type.Enabled = true; cboItem_type.CssClass = "textbox"; txtitem_name.ReadOnly = false; txtitem_name.CssClass = "textbox"; cboItem_group.Enabled = true; cboItem_group.CssClass = "textbox"; cboLot.Enabled = true; cboLot.CssClass = "textbox"; txtcheque_code.ReadOnly = false; txtcheque_code.CssClass = "textbox"; txtcheque_name.ReadOnly = false; txtcheque_name.CssClass = "textbox"; chkStatus.Checked = true; } else { cboItem_type.Enabled = false; cboItem_type.CssClass = "textboxdis"; txtitem_code.ReadOnly = true; txtitem_code.CssClass = "textboxdis"; txtitem_name.ReadOnly = true; txtitem_name.CssClass = "textboxdis"; cboItem_group.Enabled = false; cboItem_group.CssClass = "textboxdis"; cboLot.Enabled = false; cboLot.CssClass = "textboxdis"; txtcheque_code.ReadOnly = true; txtcheque_code.CssClass = "textboxdis"; txtcheque_name.ReadOnly = true; txtcheque_name.CssClass = "textboxdis"; chkStatus.Checked = false; } cboYear.CssClass = "textboxdis"; txtitem_code.ReadOnly = true; txtitem_code.CssClass = "textboxdis"; if (stritem_type.Equals("D")) { InitcboLot(); if (cboLot.Items.FindByValue(strlot_code) != null) { cboLot.SelectedIndex = -1; cboLot.Items.FindByValue(strlot_code).Selected = true; } InitcboItem_group(); if (cboItem_group.Items.FindByValue(stritem_group_code) != null) { cboItem_group.SelectedIndex = -1; cboItem_group.Items.FindByValue(stritem_group_code).Selected = true; } cboLot.Enabled = true; cboItem_group.Enabled = true; } else { cboLot.Enabled = false; cboItem_group.Enabled = false; } txtUpdatedBy.Text = strUpdatedBy; txtUpdatedDate.Text = strUpdatedDate; #endregion } } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } }
public static bool ItemUpdate(cItem cItems) { using (mysqlConnection = new MySqlConnection(strProvider)) { mysqlConnection.Open(); MySqlCommand mySqlCommand = new MySqlCommand("UPDATE t_item SET a_rare_prob_9 = @RareProb9, a_rare_prob_8 = @RareProb8, a_rare_prob_7 = @RareProb7, a_rare_prob_6 = @RareProb6, a_rare_prob_5 = @RareProb5, a_rare_prob_4 = @RareProb4, a_rare_prob_3 = @RareProb3, a_rare_prob_2 = @RareProb2, a_rare_prob_1 = @RareProb1, a_rare_prob_0 = @RareProb0, a_rare_index_9 = @RareID9, a_rare_index_8 = @RareID8, a_rare_index_7 = @RareID7, a_rare_index_6 = @RareID6, a_rare_index_5 = @RareID5, a_rare_index_4 = @RareID4, a_rare_index_3 = @RareID3, a_rare_index_2 = @RareID2, a_rare_index_1 = @RareID1, a_rare_index_0 = @RareID0, a_weight = @Stacks, a_texture_row = @texROW, a_texture_col = @texCOL, a_texture_id = @texID, a_enable = @Enable, a_max_use = @MaxUse, a_zone_flag = @ZoneFlag, a_origin_variation6 = @ORIGIN6, a_origin_variation5 = @ORIGIN5, a_origin_variation4 = @ORIGIN4, a_origin_variation3 = @ORIGIN3, a_origin_variation2 = @ORIGIN2, a_origin_variation2 = @ORIGIN2, a_origin_variation1 = @ORIGIN1, a_set_4 = @SET4, a_set_3 = @SET3, a_set_2 = @SET2, a_set_1 = @SET1, a_set_0 = @SET0, a_num_4 = @NUM4, a_num_3 = @NUM3, a_num_2 = @NUM2, a_num_1 = @NUM1, a_num_0 = @NUM0, a_rvr_value = @RVRValue, a_rvr_grade = @RVRGrade, a_fame = @Fame, a_durability = @Durablity, a_grade = @Grade, a_job_flag = @JobFlag, a_level2 = @Level2, a_level = @Level1, a_flag = @Flag, a_wearing = @Position, a_subtype_idx = @SubType, a_type_idx = @Type, a_damage_effect_name = @EDamage, a_attack_effect_name = @EAttack, a_effect_name = @ENormal, a_file_smc = @smc, a_quest_trigger_ids = @QTIDs, a_quest_trigger_count = @QTCount, a_price = @price, a_name_thai = @name_thai, a_name_thai_eng = @name_thai_eng, a_name_jpn = @name_jpn, a_name_mal = @name_mal, a_name_mal_eng = @name_mal_eng, a_name_usa = @name_usa, a_name_brz = @name_brz, a_name_hk = @name_hk, a_name_hk_eng = @name_hk_eng, a_name_ger = @name_ger, a_name_spn = @name_spn, a_name_frc = @name_frc, a_name_pld = @name_pld, a_name_rus = @name_rus, a_name_tur = @name_tur, a_name_spn2 = @name_spn2, a_name_frc2 = @name_frc2, a_name_ita = @name_ita, a_name_mex = @name_mex, a_name_nld = @name_nld, a_name = @name, a_name_twn = @name_twn, a_name_chn = @name_chn, a_descr_thai = @descr_thai, a_descr_thai_eng = @descr_thai_eng, a_descr_jpn = @descr_jpn, a_descr_mal = @descr_mal, a_descr_mal_eng = @descr_mal_eng, a_descr_usa = @descr_usa, a_descr_brz = @descr_brz, a_descr_hk = @descr_hk, a_descr_hk_eng = @descr_hk_eng, a_descr_ger = @descr_ger, a_descr_spn = @descr_spn, a_descr_frc = @descr_frc, a_descr_pld = @descr_pld, a_descr_rus = @descr_rus, a_descr_tur = @descr_tur, a_descr_spn2 = @descr_spn2, a_descr_frc2 = @descr_frc2, a_descr_ita = @descr_ita, a_descr_mex = @descr_mex, a_descr_nld = @descr_nld, a_descr = @descr, a_descr_twn = @descr_twn, a_descr_chn = @descr_chn WHERE a_index = @index", mysqlConnection); mySqlCommand.Prepare(); mySqlCommand.Parameters.AddWithValue("@index", cItems.ID); mySqlCommand.Parameters.AddWithValue("@price", cItems.Price); mySqlCommand.Parameters.AddWithValue("@QTCount", cItems.QuestTriggerCount); mySqlCommand.Parameters.AddWithValue("@QTIDs", cItems.QuestTriggerIDs); mySqlCommand.Parameters.AddWithValue("@ENormal", cItems.EffectNormal); mySqlCommand.Parameters.AddWithValue("@EAttack", cItems.EffectAttack); mySqlCommand.Parameters.AddWithValue("@EDamage", cItems.EffectDamage); mySqlCommand.Parameters.AddWithValue("@Type", cItems.ItemType); mySqlCommand.Parameters.AddWithValue("@SubType", cItems.ItemSubType); mySqlCommand.Parameters.AddWithValue("@Position", cItems.Wearing); mySqlCommand.Parameters.AddWithValue("@Flag", cItems.ItemFlag); mySqlCommand.Parameters.AddWithValue("@Level1", cItems.LevelMin); mySqlCommand.Parameters.AddWithValue("@Level2", cItems.LevelMax); mySqlCommand.Parameters.AddWithValue("@JobFlag", cItems.JobFlag); mySqlCommand.Parameters.AddWithValue("@Grade", cItems.Grade); mySqlCommand.Parameters.AddWithValue("@Durablity", cItems.Durability); // mySqlCommand.Parameters.AddWithValue("@Set", cItems.Set); mySqlCommand.Parameters.AddWithValue("@Fame", cItems.Fame); mySqlCommand.Parameters.AddWithValue("@RVRGrade", cItems.RVRGrade); mySqlCommand.Parameters.AddWithValue("@RVRValue", cItems.RVRValue); mySqlCommand.Parameters.AddWithValue("@ZoneFlag", cItems.ZoneFlag); mySqlCommand.Parameters.AddWithValue("@MaxUse", cItems.MaxUse); mySqlCommand.Parameters.AddWithValue("@Enable", cItems.Enable); mySqlCommand.Parameters.AddWithValue("@texID", cItems.TexID); mySqlCommand.Parameters.AddWithValue("@texROW", cItems.TexROW); mySqlCommand.Parameters.AddWithValue("@texCOL", cItems.TexCOL); mySqlCommand.Parameters.AddWithValue("@Stacks", cItems.Weight); mySqlCommand.Parameters.AddWithValue("@smc", cItems.SMC); for (int i = 1; i <= 6; i++) { mySqlCommand.Parameters.AddWithValue("@ORIGIN" + i, cItems.ORIGIN[i]); } for (int i = 0; i <= 4; i++) { mySqlCommand.Parameters.AddWithValue("@NUM" + i, cItems.NUM[i]); mySqlCommand.Parameters.AddWithValue("@SET" + i, cItems.SET[i]); } for (int i = 0; i <= 9; i++) { mySqlCommand.Parameters.AddWithValue("@RareID" + i, cItems.RAREID[i]); mySqlCommand.Parameters.AddWithValue("@RareProb" + i, cItems.RAREPROB[i]); } for (int i = 0; i <= 23; i++) { mySqlCommand.Parameters.AddWithValue((i == 0) ? "@name" : "@name_" + Enum.GetName(typeof(Language), i).ToLower(), cItems.Name[i]); mySqlCommand.Parameters.AddWithValue((i == 0) ? "@descr" : "@descr_" + Enum.GetName(typeof(Language), i).ToLower(), cItems.Description[i]); } return(mySqlCommand.ExecuteNonQuery() == 1); } }
private bool saveData() { bool blnResult = false; bool blnDup = false; bool blnDebit = false; string strMessage = string.Empty; string stritem_code = string.Empty, stritem_year = string.Empty, stritem_type = string.Empty, stritem_name = string.Empty, stritem_group_code = string.Empty, strlot_code = string.Empty, strperson_group_code = string.Empty, strActive = string.Empty, strCreatedBy = string.Empty, strUpdatedBy = string.Empty, strcheque_code = string.Empty, strcheque_type = string.Empty, stritem_acc_code = string.Empty, stritem_project_code1 = string.Empty, stritem_project_code2 = string.Empty, strdirect_pay_code = string.Empty; string strScript = string.Empty; cItem oItem = new cItem(); DataSet ds = new DataSet(); try { #region set Data stritem_code = txtitem_code.Text.Trim(); stritem_year = cboYear.SelectedValue; stritem_name = txtitem_name.Text.Trim(); stritem_type = cboItem_type.SelectedValue; stritem_group_code = cboItem_group.SelectedValue; strlot_code = cboLot.SelectedValue; strperson_group_code = cboPerson_group.SelectedValue; strcheque_code = txtcheque_code.Text; strcheque_type = cboCheque_type.SelectedValue; stritem_acc_code = cboItem_acc.SelectedValue; stritem_project_code1 = txtitem_project_code1.Text; stritem_project_code2 = txtitem_project_code2.Text; strdirect_pay_code = txtdirect_pay_code.Text; if (chkStatus.Checked == true) { strActive = "Y"; } else { strActive = "N"; } strCreatedBy = Session["username"].ToString(); strUpdatedBy = Session["username"].ToString(); #endregion if (stritem_type.Equals("D")) { if (strlot_code.Equals("")) { strScript = "alertjava(\"ประเภทรายการเป็น Debit ต้องระบะรหัสงบประมาณโปรดตรวจสอบ\");\n"; blnDebit = true; } } if (!blnDebit) { string strCheckAdd = " and item_code = '" + stritem_code.Trim() + "' "; if (!oItem.SP_ITEM_SEL(strCheckAdd, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { #region check dup string strCheckDup = string.Empty; strCheckDup = " and item_name='" + stritem_name + "' " + " and item_year='" + stritem_year + "' " + " and item_code<>'" + stritem_code + "' "; if (!oItem.SP_ITEM_SEL(strCheckDup, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { strScript = "alertjava(\"ไม่สามารถแก้ไขข้อมูลได้ เนื่องจาก ข้อมูลรายได้/ค่าใช้จ่ายซ้ำ\");\n"; blnDup = true; } } #endregion #region edit if (!blnDup) { if (oItem.SP_ITEM_UPD(stritem_code, stritem_year, stritem_name, stritem_type, stritem_group_code, strlot_code, strperson_group_code, strActive, strUpdatedBy, strcheque_code, strcheque_type, stritem_acc_code, stritem_project_code1, stritem_project_code2, cboBudget_type.SelectedValue, strdirect_pay_code, ref strMessage)) { blnResult = true; } else { lblError.Text = strMessage.ToString(); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "chkdup", strScript, true); } #endregion } else { #region check dup string strCheckDup = string.Empty; strCheckDup = " and item_name='" + stritem_name + "' " + " and item_year='" + stritem_year + "' "; if (!oItem.SP_ITEM_SEL(strCheckDup, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { strScript = "alert(\"ไม่สามารถแก้ไขข้อมูลได้ เนื่องจาก ข้อมูลรายได้/ค่าใช้จ่ายซ้ำ\");\n"; blnDup = true; } } #endregion #region insert if (!blnDup) { if (oItem.SP_ITEM_INS(stritem_year, stritem_name, stritem_type, stritem_group_code, strlot_code, strperson_group_code, strActive, strCreatedBy, strcheque_code, strcheque_type, stritem_acc_code, stritem_project_code1, stritem_project_code2, cboBudget_type.SelectedValue, strdirect_pay_code, ref strMessage)) { string strGetcode = " and item_name='" + stritem_name + "' " + " and item_year='" + stritem_year + "' " + " and item_type='" + stritem_type + "' " + " and item_group_code='" + stritem_group_code + "' " + " and lot_code ='" + strlot_code + "' "; if (!oItem.SP_ITEM_SEL(strGetcode, ref ds, ref strMessage)) { lblError.Text = strMessage; } if (ds.Tables[0].Rows.Count > 0) { stritem_code = ds.Tables[0].Rows[0]["item_code"].ToString(); } ViewState["item_code"] = stritem_code; blnResult = true; } else { lblError.Text = strMessage.ToString(); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", strScript, true); } #endregion } } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "chk", strScript, true); } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oItem.Dispose(); } return(blnResult); }
private void BindGridView(int nPageNo) { InitcboYear(); cItem oItem = new cItem(); DataSet ds = new DataSet(); string strMessage = string.Empty; string strCriteria = string.Empty; var item = new view_Item { item_year = cboYear.SelectedValue, item_code = txtitem_code.Text.Replace("'", "''").Trim(), item_name = txtitem_name.Text.Replace("'", "''").Trim(), item_group_type = cboItem_type.SelectedValue, item_group_code = cboItemGroup.SelectedValue, item_group_detail_id = string.IsNullOrEmpty(cboItemGroupDetail.SelectedValue) ? 0 : int.Parse(cboItemGroupDetail.SelectedValue) }; if (!item.item_year.Equals("")) { strCriteria = strCriteria + " And (item_year = '" + item.item_year + "') "; } if (!item.item_code.Equals("")) { strCriteria = strCriteria + " And (item_code like '%" + item.item_code + "%') "; } if (!item.item_name.Equals("")) { strCriteria = strCriteria + " And (item_name like '%" + item.item_name + "%') "; } if (!item.item_group_type.Equals("")) { strCriteria = strCriteria + " And (item_group_type = '" + item.item_group_type + "') "; } if (!item.item_group_code.Equals("")) { strCriteria = strCriteria + " And (item_group_code like '%" + item.item_group_code + "%') "; } if (item.item_group_detail_id > 0) { strCriteria = strCriteria + " And (item_group_detail_id = '" + item.item_group_detail_id + "') "; } if (RadioActive.Checked) { strCriteria = strCriteria + " And (c_active ='Y') "; } else if (RadioCancel.Checked) { strCriteria = strCriteria + " And (c_active ='N') "; } //if (DirectorLock == "N") //{ // strCriteria += " and lot_code in (''," + LotCodeList + ") "; //} try { if (!oItem.SP_ITEM_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { try { GridView1.PageIndex = nPageNo; txthTotalRecord.Value = ds.Tables[0].Rows.Count.ToString(); ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"]; GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } catch { GridView1.PageIndex = 0; txthTotalRecord.Value = ds.Tables[0].Rows.Count.ToString(); ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"]; GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oItem.Dispose(); ds.Dispose(); if (GridView1.Rows.Count > 0) { GridView1.TopPagerRow.Visible = true; } } }
public static async void GetItems() { ItemData = new List <cItem>(); var dbData = await QueryToDataTable("SELECT * FROM t_item ORDER BY a_index;"); Parallel.ForEach(dbData.AsEnumerable(), new ParallelOptions { MaxDegreeOfParallelism = 1 }, dataRow => { cItem cItem = new cItem { ID = Convert.ToInt32(dataRow["a_index"]), SMC = Convert.ToString(dataRow["a_file_smc"]), Price = Convert.ToInt32(dataRow["a_price"]), QuestTriggerCount = Convert.ToInt32(dataRow["a_quest_trigger_count"]), QuestTriggerIDs = Convert.ToString(dataRow["a_quest_trigger_ids"]), EffectNormal = Convert.ToString(dataRow["a_effect_name"]), EffectAttack = Convert.ToString(dataRow["a_attack_effect_name"]), EffectDamage = Convert.ToString(dataRow["a_damage_effect_name"]), ItemType = Convert.ToInt32(dataRow["a_type_idx"]), ItemSubType = Convert.ToInt32(dataRow["a_subtype_idx"]), Wearing = Convert.ToInt32(dataRow["a_wearing"]), ItemFlag = Convert.ToUInt64(dataRow["a_flag"]), LevelMin = Convert.ToInt32(dataRow["a_level"]), LevelMax = Convert.ToInt32(dataRow["a_level2"]), JobFlag = Convert.ToUInt64(dataRow["a_job_flag"]), Grade = Convert.ToInt32(dataRow["a_grade"]), Durability = Convert.ToInt32(dataRow["a_durability"]), Set = Convert.ToInt32(dataRow["a_set"]), // Looks like it's not used Fame = Convert.ToInt32(dataRow["a_fame"]), RVRGrade = Convert.ToInt32(dataRow["a_rvr_grade"]), RVRValue = Convert.ToInt32(dataRow["a_rvr_value"]), ZoneFlag = Convert.ToInt32(dataRow["a_zone_flag"]), MaxUse = Convert.ToInt32(dataRow["a_max_use"]), Enable = Convert.ToInt32(dataRow["a_enable"]), TexID = Convert.ToInt32(dataRow["a_texture_id"]), TexCOL = Convert.ToInt32(dataRow["a_texture_col"]), TexROW = Convert.ToInt32(dataRow["a_texture_row"]), Weight = Convert.ToInt32(dataRow["a_weight"]), CastleWar = Convert.ToInt32(dataRow["a_castle_war"]), NUM = new int[5], SET = new int[5], ORIGIN = new int[10], RAREID = new int[10], RAREPROB = new int[10], Name = new string[24], Description = new string[24] }; for (int i = 0; i <= 4; i++) { cItem.NUM[i] = Convert.ToInt32(dataRow["a_num_" + i]); cItem.SET[i] = Convert.ToInt32(dataRow["a_set_" + i]); } for (int i = 1; i <= 6; i++) { cItem.ORIGIN[i] = Convert.ToInt32(dataRow["a_origin_variation" + i]); } for (int i = 0; i <= 9; i++) { cItem.RAREID[i] = Convert.ToInt32(dataRow["a_rare_index_" + i]); cItem.RAREPROB[i] = Convert.ToInt32(dataRow["a_rare_prob_" + i]); } for (int i = 0; i <= 23; i++) { cItem.Name[i] = (i == 0) ? (string)dataRow["a_name"] : (string)dataRow["a_name_" + Enum.GetName(typeof(Language), i).ToLower()]; cItem.Description[i] = (i == 0) ? (string)dataRow["a_descr"] : (string)dataRow["a_descr_" + Enum.GetName(typeof(Language), i).ToLower()]; } ItemData.Add(cItem); }); }
public IHttpActionResult transactionAdd([FromBody] ClsRequestTransaction body) { try { CFungsi fungsi = new CFungsi(); /* * {"token":"d0bdc5221da9ba6305a1e2c685c2f8bb0444d3db","created":"2019-09-26T15:11:11+07","user":"******", * "store":"TB77","number_of_people":1,"invoice_number":"NTDL00UT10068701TB77190926104000000015", * "stamps":3,"total_value":60000.0, * "items":[{"product_name":"20072105","quantity":5,"price":20000.0}],"extra_data":[{"promo":"NTDL00UT"}]} * */ ClsResponseTransaction response = new ClsResponseTransaction(); //response ke merchant string bodyJson = JsonConvert.SerializeObject(body); fungsi.tracelog("TRANSACTION ADD MASUK : " + bodyJson); List <ReqCore_earning> earningCoreList = new List <ReqCore_earning>(); //request ke core // isi data earningCore ReqCore_earning earning = new ReqCore_earning(); earning.add_time = DateTime.Now; earning.card_num = body.user; earning.invoice_number = body.invoice_number; earning.id_bucket = body.token; //token yang digunakan di stamps sekarang diisikan ke idbucket untuk nanti dikonversi jadi bucket earning.id_merchant = "3"; //pantek ID MERCHANT SELALU 3 (INDOMARET) di core earning.id_toko = body.store; earning.kode_cabang = body.store; earning.kode_promo = body.extra_data[0].promo; earning.point = body.stamps; earning.total_value = (int)body.total_value; for (int i = 0; i < body.items.Length; i++) { cItem item = new cItem(); item.price = body.items[i].price; item.product_name = body.items[i].product_name; item.quantity = body.items[i].quantity; earning.items.Add(item); } earningCoreList.Add(earning); string jsonRequest = JsonConvert.SerializeObject(earningCoreList); MyPoinCore.service2 service = new MyPoinCore.service2(); fungsi.tracelog("TRANSACTION ADD REQUEST CORE " + service.Url + " --> " + jsonRequest); string[] JsonResponse = service.earning_point(jsonRequest); fungsi.tracelog("TRANSACTION ADD RESPONSE CORE : " + JsonResponse[0] + "//" + JsonResponse[1] + "//" + JsonResponse[2]); if (JsonResponse[0] == "0") //balikan dari core sukses { //response dari core List <RespCore_earning> RespEarningCore = new List <RespCore_earning>(); RespEarningCore = JsonConvert.DeserializeObject <List <RespCore_earning> >(JsonResponse[1]); response.customer.balance = RespEarningCore[0].customer.balance; response.customer.id = 1; // RespEarningCore[0].customer.card_num; response.customer.mobile_phone = RespEarningCore[0].customer.mobile_phone; if (RespEarningCore[0].customer.stamps_remaining == 0) { response.customer.stamps_remaining = RespEarningCore[0].customer.point_remaining; } else { response.customer.stamps_remaining = RespEarningCore[0].customer.stamps_remaining; } response.customer.status = RespEarningCore[0].customer.status.ToString(); response.transaction.id = 1; //RespEarningCore[0].transaction.invoice_number; if (RespEarningCore[0].transaction.stamps_earned == 0) { response.transaction.stamps_earned = RespEarningCore[0].transaction.point_earned; } else { response.transaction.stamps_earned = RespEarningCore[0].transaction.stamps_earned; } response.transaction.value = RespEarningCore[0].transaction.total_value; string returnResponse = JsonConvert.SerializeObject(response); fungsi.tracelog("TRANSACTION ADD RETURN " + returnResponse); return(Json(response)); } else { fungsi.tracelog("TRANSACTION ADD RETURN " + JsonResponse[1]); return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, JsonResponse[1]))); //kalo balikan dari core error } } catch (Exception ex) { CFungsi fungsi = new CFungsi(); fungsi.tracelog("error at transaction add " + ex.Message + " -- " + ex.StackTrace); return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message))); } }
protected bool SetUserProfile(string strUserName, string strPassword, ref string _strError) { bool booResult = false; cUser objUser = new cUser(); DataTable dt = new DataTable(); DataSet ds = new DataSet(); string strCriteria; string strMessage = string.Empty; string strDecryptPassword = string.Empty; strCriteria = " And LoginName='" + strUserName + "' "; objUser.SP_USER_SEL(strCriteria, ref ds, ref strMessage); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { strDecryptPassword = Cryptorengine.Decrypt(Helper.CStr(dt.Rows[0]["Password"]), true); if (strDecryptPassword.Equals(strPassword)) { this.IsLogin = "******"; this.UserID = Helper.CInt(dt.Rows[0]["UserID"]); this.UserLoginName = Helper.CStr(dt.Rows[0]["LoginName"]); this.DirectorLock = Helper.CStr(dt.Rows[0]["director_lock"]); this.DirectorCode = Helper.CStr(dt.Rows[0]["director_code"]); this.DirectorName = Helper.CStr(dt.Rows[0]["director_name"]); try { this.UnitLock = Helper.CStr(dt.Rows[0]["unit_lock"]); } catch { this.UnitLock = "N"; } if (this.UnitLock == "Y") { this.UnitCodeList = string.Empty; string[] strunit_code_list = Helper.CStr(dt.Rows[0]["unit_code_list"]).Split(','); for (int i = 0; i <= (strunit_code_list.GetUpperBound(0)); i++) { this.UnitCodeList += "'" + strunit_code_list[i].Substring(3, 5) + "',"; } this.UnitCodeList = this.UnitCodeList.Substring(0, this.UnitCodeList.Length - 1); } this.myBudgetType = Helper.CStr(dt.Rows[0]["budget_type"]); string[] strperson_group_list = Helper.CStr(dt.Rows[0]["person_group_list"]).Split(','); for (int i = 0; i <= (strperson_group_list.GetUpperBound(0)); i++) { PersonGroupList = PersonGroupList + "'" + strperson_group_list[i] + "',"; } PersonGroupList = PersonGroupList.Substring(0, PersonGroupList.Length - 1); cItem objItem = new cItem(); DataTable dt2 = new DataTable(); DataSet ds2 = new DataSet(); string strYear = ((DataSet)Application["xmlconfig"]).Tables["default"].Rows[0]["yearnow"].ToString(); strCriteria = " And person_group_code in (" + PersonGroupList + ") And lot_code<>'' "; strCriteria += " And item_year = " + strYear; objItem.SP_ITEM_LOT_GROUP_SEL(strCriteria, ref ds2, ref strMessage); LotCodeList = string.Empty; for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { LotCodeList = LotCodeList + "'" + ds2.Tables[0].Rows[i]["lot_code"].ToString() + "',"; } if (LotCodeList.Length > 0) { LotCodeList = LotCodeList.Substring(0, LotCodeList.Length - 1); } booResult = true; } else { _strError = "รหัสผ่านไม่ถูกต้อง"; } } else { _strError = "ไม่พบผู้ใช้งานนี้"; } return(booResult); }