protected void btnUseEngineNumber_Click(object sender, EventArgs e) { string enNo = ddlPrefix.SelectedValue + txtSearchEngineNo.Text.Trim() + "%"; ItemInstanceDataSource ds = new ItemInstanceDataSource(); IList<ItemInstance> items = ds.SelectForSRS(1, 0, enNo, ddlDealer.SelectedValue); if (items.Count > 0) { SelectAnEngine(items[0]); } else { SelectAnEngineNo(enNo, "-1", "", "", "", "", "", "", ""); } ClosePopup(string.Format("engineSelected('{0}')", enNo)); }
protected void InputWarrantyInfo(object sender, EventArgs e) { gvItemins.Visible = false; //chac' cu', lam luc ko validate client dc if (string.IsNullOrEmpty(txtPurchaseDateInput.Text.Trim())) { rfvPurchaseDateInput.IsValid = false; return; } ItemInstanceDataSource ids = new ItemInstanceDataSource(); IList<ItemInstance> lsIns = ids.Select(2, 0, txtEngineNumberInput.Text.Trim(), null); if (lsIns.Count != 1) { btnInsertWarrantyInfo.CommandName = ""; ShowMessage(Message.WarrantyInfo_EngineNumberInvalid, true); return; } ItemInstance iIns = lsIns[0]; //BindItemInf(iIns.Enginenumber); if (!btnInsertWarrantyInfo.CommandName.Equals("ActionConflict")) { _CustomerID.Value = "-1"; } //ISession sess = NHibernateSessionManager.Instance.GetSession(); //IList lstItemWan = sess.CreateCriteria(typeof(Warrantyinfo)) // .Add(Expression.Eq("Id", iIns.Enginenumber)).List(); //if (lstItemWan.Count > 0 && !btnInsertWarrantyInfo.CommandName.Equals("ActionConflict")) //{ // ShowMessage(Message.WarrantyInfo_EditStatus, false); // Warrantyinfo wr = lstItemWan[0] as Warrantyinfo; // txtKmCountInput.Text = wr.Kmcount.ToString(); // txtPurchaseDateInput.Text = wr.Purchasedate.ToShortDateString(); // ddlDealerCode.SelectedValue = wr.Selldealercode; // ddlDealerCode.Enabled = false; // BindCustomer(wr.Customer); // btnInsertWarrantyInfo.CommandName = "ActionConflict"; // rfvPurchaseDateInput.ValidationGroup = "Input"; // return; //} //else if (lstItemWan.Count == 0 && !btnInsertWarrantyInfo.CommandName.Equals("ActionAddnew")) //{ // btnInsertWarrantyInfo.CommandName = "ActionAddnew"; // rfvPurchaseDateInput.ValidationGroup = "Input"; // return; //} //GUI: disable three input field of warranty info txtEngineNumberInput.ReadOnly = true; txtEngineNumberInput.CssClass = "readOnlyInputField"; txtEngineNumberInput.Text = txtEngineNumberInput.Text.Trim(); txtPurchaseDateInput.Text = txtPurchaseDateInput.Text.Trim(); txtPurchaseDateInput.CssClass = "readOnlyInputField"; txtPurchaseDateInput.ReadOnly = true; if (String.IsNullOrEmpty(txtKmCountInput.Text.Trim())) txtKmCountInput.Text = "0"; txtKmCountInput.ReadOnly = true; txtKmCountInput.CssClass = "readOnlyInputField"; txtCustomerIDInput.ReadOnly = false; txtCustomerIDInput.CssClass = ""; ddlDealerCode.Enabled = false; btnInsertCus.Enabled = true; btnInsertWarrantyInfo.Enabled = false; if (ServiceTools.SaveWarrantyInfo(iIns.EngineNumber, int.Parse(txtKmCountInput.Text), DateTime.Parse(txtPurchaseDateInput.Text), iIns.DatabaseCode, iIns.Item.ItemCode, iIns.Color, ddlDealerCode.SelectedValue, -1) == false) { ShowMessage(Message.WarrantyContent_UpdateDataFailed, true); } else { ShowMessage(Message.ActionSucessful, false); } btnInsertWarrantyInfo.CommandName = ""; btnFilterEng.Enabled = false; rfvPurchaseDateInput.ValidationGroup = "InputDraft"; CusInfph.Visible = true; }