protected override void CreateChildControls() { _state = new HiddenField {ID = ID + "_state"}; _state.ValueChanged += HandleLinkRequest; Controls.Add(_state); }
protected void Page_Load(object sender, EventArgs e) { // Set body to submit onload body.Attributes.Add("onload", "document.forms[0].submit()"); // Set form action and method paypalForm.Action = "https://www.sandbox.paypal.com/cgi-bin/webscr"; // TEST URL paypalForm.Method = "POST"; // Retrieve donations from the session var donations = BusinessLogic.Donation.GetDonations(); // Determine donation type if (donations.Count() > 1) { this.processingType = ProcessingType.Cart; } else { if (donations.First().DonationType == "Special") { this.processingType = ProcessingType.OneTime; } else { this.processingType = ProcessingType.Recurring; } } // Create collection to store values in Dictionary<string, string> formValues = new Dictionary<string, string>(); // Set default values formValues.Add("business", "*****@*****.**"); formValues.Add("no_shipping", "2"); formValues.Add("currency_code", "USD"); formValues.Add("tax", "0"); formValues.Add("no_note", "1"); // Add type specific values to collection var addedFormValues = this.AddTypeSpecificValues(donations); addedFormValues.ToList().ForEach(x => formValues.Add(x.Key, x.Value)); // Add hidden fields to form foreach (KeyValuePair<string, string> pair in formValues) { HiddenField field = new HiddenField(); field.ID = (string)pair.Key; field.Value = (string)pair.Value; paypalForm.Controls.Add(field); } // Clear session so that donations are not saved when the user returns BusinessLogic.Donation.ClearDonations(); }
/// <summary> /// Populates the value of the specified hidden field with the data /// associated with the specified querystring param. Populates the /// field with an empty string if parameter does not exist. /// </summary> /// <param name="hiddenField">HiddenField to populate</param> /// <param name="queryStringParam">Query string parameter</param> private void PopulateHiddenField(HiddenField hiddenField, string queryStringParam) { if (!string.IsNullOrEmpty(Request.QueryString[queryStringParam])) { hiddenField.Value = Request.QueryString[queryStringParam]; } else { hiddenField.Value = string.Empty; } }
protected void Page_Load(object sender, EventArgs e) { if (PreviousPage != null) { ob = (HiddenField)PreviousPage.FindControl("HiddenFieldconstituencyId"); } if (ob != null) { Int16 constituencyId = Convert.ToInt16(ob.Value); loadmpdetails(constituencyId); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { OperaterDropDownList = (DropDownList)e.Row.Cells[1].FindControl("selOperator"); OperaterDropDownList.Attributes.Add("onchange", "OperatorChange(this);"); // add by zy 20110107 start string fieldName = ((System.Data.DataRowView)(e.Row.DataItem)).Row.ItemArray[2].ToString(); TextBox TBCondiction1 = (TextBox)e.Row.Cells[2].FindControl("txtCondition1"); HtmlImage IBSelect = (HtmlImage)e.Row.Cells[3].FindControl("imgSelect"); IBSelect.Attributes.Add("onclick", string.Format("topopmask('../SelectReportCondiction.aspx',800,450,'Select Report Condition','{0}','{1}');", TBCondiction1.ClientID, fieldName)); // add by zy 20110107 end FieldTypeHiddenField = (HiddenField)e.Row.Cells[3].FindControl("hidFieldType"); BoundOperater(OperaterDropDownList, FieldTypeHiddenField.Value); } }
private void CreatePageControl() { // Create dynamic controls here. btnNextPage = new Button(); btnNextPage.ID = "btnNextPage"; Form1.Controls.Add(btnNextPage); btnNextPage.Click += new System.EventHandler(btnNextPage_Click); btnPreviousPage = new Button(); btnPreviousPage.ID = "btnPreviousPage"; Form1.Controls.Add(btnPreviousPage); btnPreviousPage.Click += new System.EventHandler(btnPreviousPage_Click); btnGoPage = new Button(); btnGoPage.ID = "btnGoPage"; Form1.Controls.Add(btnGoPage); btnGoPage.Click += new System.EventHandler(btnGoPage_Click); HFD_CurrentPage = new HiddenField(); HFD_CurrentPage.Value = "1"; HFD_CurrentPage.ID = "HFD_CurrentPage"; Form1.Controls.Add(HFD_CurrentPage); }
protected void btnSend_Click(object sender, EventArgs e) { Page.Validate("mailCredentials"); if (!Page.IsValid) { return; } using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString)) { int selectedRecipientCount = 0; con.Open(); string mailSubject; foreach (RepeaterItem i in rptrCategory.Items)//making sure user has selected atleast one recipient { Repeater rptrRecipient = (Repeater)i.FindControl("rptrRecipient"); foreach (RepeaterItem j in rptrRecipient.Items) { CheckBox cbRecipient = (CheckBox)j.FindControl("cbRecipient"); if (cbRecipient.Checked) { selectedRecipientCount++; } } } if (selectedRecipientCount == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "ShowMessage('Please select atleast one recipient to send the mail', 'Warning','labelStatusAlert');", true); } else { //saving the sent maildata into database if (tbxMailSubject.Text == "") { mailSubject = "No subject"; } else { mailSubject = tbxMailSubject.Text; } SqlCommand saveEmail = new SqlCommand("spSaveMail", con); saveEmail.CommandType = CommandType.StoredProcedure; saveEmail.Parameters.AddWithValue("@body", tbxMailBody.Text); saveEmail.Parameters.AddWithValue("@templateId", rbTemplates.SelectedItem.Value); saveEmail.Parameters.AddWithValue("@userId", Convert.ToInt32(Session["LoggedIn"])); saveEmail.Parameters.AddWithValue("@subject", mailSubject); int sentMailId = Convert.ToInt32(saveEmail.ExecuteScalar()); Session["sentMailId"] = sentMailId; if (fileAttachment.HasFiles) { foreach (HttpPostedFile uploadedFile in fileAttachment.PostedFiles) { SqlCommand saveFileAttachments = new SqlCommand("insert into tblFileAttachments(sentMailId,fileName,fileSize) values(@sentMailId,@fileName,@fileSize)", con); saveFileAttachments.Parameters.AddWithValue("@sentMailId", sentMailId); saveFileAttachments.Parameters.AddWithValue("@fileName", uploadedFile.FileName); saveFileAttachments.Parameters.AddWithValue("@fileSize", uploadedFile.ContentLength); saveFileAttachments.ExecuteNonQuery(); string filePath = "~/fileAttachments" + uploadedFile.FileName; uploadedFile.SaveAs(Server.MapPath(filePath)); } } try { foreach (RepeaterItem i in rptrCategory.Items) { Repeater rptrRecipient = (Repeater)i.FindControl("rptrRecipient"); foreach (RepeaterItem j in rptrRecipient.Items) { HiddenField hfRecipientID = (HiddenField)j.FindControl("hfRecipientId"); CheckBox cbRecipient = (CheckBox)j.FindControl("cbRecipient"); if (cbRecipient.Checked) { SqlCommand saveRecipientId = new SqlCommand("insert into tblMailRecipient(sentMailId,recipientId) values(@sentMailId,@recipientId)", con); saveRecipientId.Parameters.AddWithValue("@sentMailId", sentMailId); saveRecipientId.Parameters.AddWithValue("@recipientId", hfRecipientID.Value); saveRecipientId.ExecuteNonQuery(); sendEmail(Convert.ToInt32(hfRecipientID.Value)); } } } ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "ShowMessage(' All the emails were sent succesfully.', 'Success','labelStatusAlert');", true); tbxMailBody.Text = ""; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "ShowMessage('Wrong Password', 'Error','labelStatusAlert');", true); SqlCommand deleteMailRecipient = new SqlCommand("delete from tblMailRecipient where sentMailId='" + sentMailId + "'", con); deleteMailRecipient.ExecuteNonQuery(); SqlCommand deleteAttachment = new SqlCommand("delete from tblFileAttachments where sentMailId='" + sentMailId + "'", con); deleteAttachment.ExecuteNonQuery(); SqlCommand deleteMail = new SqlCommand("delete from tblSentMails where sentMailId='" + sentMailId + "'", con); deleteMail.ExecuteNonQuery(); } } } }
/// <summary> /// با لود شدن صفحه لیست هایی شامل اطلاعات جدید و قدیم دانشجو نمایش داده می شود /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { rdb_newinfos(); Session["stcode"] = Request.QueryString["stcode"].ToString(); if (!IsPostBack) { dt = CartBusiness.GetStudentsInfo(Session["stcode"].ToString()); rdlv_previous.DataSource = dt; rdlv_previous.DataBind(); newmobile = dt.Rows[0]["mobile"].ToString(); string[] add = dt.Rows[0]["homeAddress"].ToString().Split('-'); if (add.Length == 3) { newaddress = add[2].ToString(); } else { newaddress = add[0].ToString(); } newtel = dt.Rows[0]["homePhone"].ToString(); newcodeposti = dt.Rows[0]["home_postalCode"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["home_state"].ToString())) { newostan = int.Parse(dt.Rows[0]["home_state"].ToString()); } //if (!string.IsNullOrEmpty(dt.Rows[0]["live_city_web"].ToString())) // newshahr = int.Parse(dt.Rows[0]["live_city_web"].ToString()); if (dt.Rows.Count > 0) { foreach (RadListViewDataItem lvid in rdlv_previous.Items) { Label lbl_CodePostiPrev = (Label)lvid.FindControl("lbl_CodePostiPrev"); Label lbl_AddressPrev = (Label)lvid.FindControl("lbl_AddressPrev"); Label lbl_TellPrev = (Label)lvid.FindControl("lbl_TellPrev"); Label lbl_MobilePrev = (Label)lvid.FindControl("lbl_MobilePrev"); } } dtm = EditBusiness.GetSTudentEditRequest(Session["stcode"].ToString()); rdlv_New.DataSource = dtm; rdlv_New.DataBind(); foreach (RadListViewDataItem lst in rdlv_New.Items) { RadioButton rdb_ConfNewInfo = (RadioButton)lst.FindControl("rdb_ConfNewInfo"); RadioButton rdb_NewInfo = (RadioButton)lst.FindControl("rdb_NewInfo"); Label lbl_EditedID = (Label)lst.FindControl("lbl_EditedID"); Label lbl_NewContent = (Label)lst.FindControl("lbl_NewContent"); HiddenField hdf_NewContent = (HiddenField)lst.FindControl("hdf_NewContent"); DropDownList ddlCity = (DropDownList)lst.FindControl("ddlCity"); if (lbl_EditedID.Text == "11") { DataTable dtsh = new DataTable(); dtsh = CommonBusiness.getCity(0, int.Parse(hdf_NewContent.Value.ToString())); //if (dtsh.Rows.Count > 0) // lbl_NewContent.Text = dtsh.Rows[0]["Title"].ToString(); //else //{ //lbl_NewContent.Text = "سایر"; //------------------------------- lbl_NewContent.Visible = false; var stateRequest = dtm.AsEnumerable().Where(w => w.Field <int>("EditedID") == 12); var state = 0; if (stateRequest.Count() > 0) { state = Convert.ToInt32(stateRequest.FirstOrDefault().Field <string>("NewContent")); } else if (!string.IsNullOrEmpty(dt.Rows[0]["home_state"].ToString())) { state = Convert.ToInt32(dt.Rows[0]["home_state"].ToString()); } if (state > 0) { ddlCity.DataSource = CommonBusiness.getCitiesFromTblShahrestan(state); ddlCity.DataTextField = "Title"; ddlCity.DataValueField = "ID"; ddlCity.DataBind(); ddlCity.Items.Insert(0, new ListItem { Text = "سایر", Value = "0", Selected = dtsh.Rows.Count == 0 }); ddlCity.Visible = true; } else { ddlCity.Visible = false; lbl_NewContent.Text = "سایر"; lbl_NewContent.Visible = true; } if (ddlCity.Visible && dtsh.Rows.Count > 0) { ddlCity.SelectedValue = hdf_NewContent.Value.ToString(); } //------------------------------- //} } else if (lbl_EditedID.Text == "12") { DataTable dtos = new DataTable(); dtos = CommonBusiness.GetStateFromTblOstan(int.Parse(hdf_NewContent.Value.ToString())); lbl_NewContent.Text = dtos.Rows[0]["Title"].ToString(); } else { lbl_NewContent.Text = hdf_NewContent.Value.ToString(); } } dts = EditBusiness.GetStudentPic(Session["stcode"].ToString()); } }
protected void btnSubmitBatchPoint_Click(object sender, EventArgs e) { ManagerHelper.CheckPrivilege(Privilege.UpdateMemberPoint); if (string.IsNullOrEmpty(this.userIds)) { base.GotoResourceNotFound(); } else { Hashtable hashtable = new Hashtable(); if (this.grdSelectedUsers.Items.Count > 0) { int num = 0; int num2 = 0; if (this.radAdd.Checked) { if (string.IsNullOrEmpty(this.txtAddPoints.Text) || !int.TryParse(this.txtAddPoints.Text.Trim(), out num)) { this.ShowMsg("要增加的积分数不能为空且为正数", false); return; } if (num <= 0) { this.ShowMsg("请输入大于0的积分数", false); return; } } else if (this.RadMinus.Checked) { if (string.IsNullOrEmpty(this.txtMinusPoints.Text) || !int.TryParse(this.txtMinusPoints.Text.Trim(), out num2)) { this.ShowMsg("要减少的积分数不能为空且为正数", false); return; } if (num2 <= 0) { this.ShowMsg("请输入大于0的积分数", false); return; } string[] array = this.userIds.Split(','); for (int i = 0; i < array.Length; i++) { MemberInfo user = Users.GetUser(int.Parse(array[i])); if (num2 > user.Points) { this.ShowMsg("会员【" + user.UserName + "】的积分不足,请调整要减去的积分", false); this.Page.ClientScript.RegisterStartupScript(base.GetType(), "msg", "<script>onRadioClick(2);</script>"); return; } } } PointDetailInfo pointDetailInfo = new PointDetailInfo(); pointDetailInfo.OrderId = ""; pointDetailInfo.TradeType = PointTradeType.AdministratorUpdate; if (this.radAdd.Checked) { pointDetailInfo.Increased = num; pointDetailInfo.Reduced = 0; } else if (this.RadMinus.Checked) { pointDetailInfo.Reduced = num2; pointDetailInfo.Increased = 0; } foreach (RepeaterItem item in this.grdSelectedUsers.Items) { TextBox textBox = item.FindControl("txtListRemark") as TextBox; HiddenField hiddenField = item.FindControl("hidUserId") as HiddenField; string text = textBox.Text; if (string.IsNullOrEmpty(textBox.Text)) { text = this.txtRemark.Text; } text = "操作员:" + HiContext.Current.Manager.UserName + " " + text; hashtable.Add(hiddenField.Value, text); } PointDetailDao pointDetailDao = new PointDetailDao(); if (pointDetailDao.BatchEditPoints(pointDetailInfo, this.userIds, hashtable)) { string[] array2 = this.userIds.Split(','); string[] array3 = array2; foreach (string s in array3) { MemberDao memberDao = new MemberDao(); int userId = 0; if (int.TryParse(s, out userId)) { MemberInfo user2 = Users.GetUser(userId); if (this.radAdd.Checked) { user2.Points += num; } else if (this.RadMinus.Checked) { int num3 = user2.Points - num2; user2.Points = ((num3 >= 0) ? num3 : 0); } int historyPoint = pointDetailDao.GetHistoryPoint(int.Parse(s), null); memberDao.ChangeMemberGrade(userId, user2.Points, historyPoint, null); if (user2 != null) { Users.ClearUserCache(userId, user2.SessionId); } } } base.CloseWindow(null); } else { this.ShowMsg("批量操作失败", false); } } } }
protected void SavePassClick(object sender, EventArgs e) { CacheLayer.Clear(CacheKeys.BookingsCacheKey); CacheLayer.Clear(CacheKeys.BlockedDatesCustomPricesCacheKey); if (RptProducts.Items.Count > 0) { var listProducts = new List <Products>(); foreach (RepeaterItem item in RptProducts.Items) { //to get the dropdown of each line HiddenField productIdHid = (HiddenField)item.FindControl("HidId"); var products = new Products { ProductId = int.Parse(productIdHid.Value) }; double regularPrice; //double upgradeDiscountPrice; int quantity; bool updateDefaultPrice = false; var regularMonText = (TextBox)item.FindControl("RegularMonText"); double.TryParse(regularMonText.Text, out regularPrice); if (!products.PriceMon.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceMon = regularPrice; var regularTueText = (TextBox)item.FindControl("RegularTueText"); double.TryParse(regularTueText.Text, out regularPrice); if (!products.PriceTue.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceTue = regularPrice; var regularWedText = (TextBox)item.FindControl("RegularWedText"); double.TryParse(regularWedText.Text, out regularPrice); if (!products.PriceWed.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceWed = regularPrice; var regularThuText = (TextBox)item.FindControl("RegularThuText"); double.TryParse(regularThuText.Text, out regularPrice); if (!products.PriceThu.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceThu = regularPrice; var regularFriText = (TextBox)item.FindControl("RegularFriText"); double.TryParse(regularFriText.Text, out regularPrice); if (!products.PriceFri.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceFri = regularPrice; var regularSatText = (TextBox)item.FindControl("RegularSatText"); double.TryParse(regularSatText.Text, out regularPrice); if (!products.PriceSat.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceSat = regularPrice; var regularSunText = (TextBox)item.FindControl("RegularSunText"); double.TryParse(regularSunText.Text, out regularPrice); if (!products.PriceSun.Equals(regularPrice)) { updateDefaultPrice = true; } products.PriceSun = regularPrice; // Upgrade Price //var upgradeMonText = (TextBox)item.FindControl("UpgradeMonText"); //double.TryParse(upgradeMonText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountMon.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountMon = upgradeDiscountPrice; //var upgradeTueText = (TextBox)item.FindControl("UpgradeTueText"); //double.TryParse(upgradeTueText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountTue.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountTue = upgradeDiscountPrice; //var upgradeWedText = (TextBox)item.FindControl("UpgradeWedText"); //double.TryParse(upgradeWedText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountWed.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountWed = upgradeDiscountPrice; //var upgradeThuText = (TextBox)item.FindControl("UpgradeThuText"); //double.TryParse(upgradeThuText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountThu.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountThu = upgradeDiscountPrice; //var upgradeFriText = (TextBox)item.FindControl("UpgradeFriText"); //double.TryParse(upgradeFriText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountFri.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountFri = upgradeDiscountPrice; //var upgradeSatText = (TextBox)item.FindControl("UpgradeSatText"); //double.TryParse(upgradeSatText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountSat.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountSat = upgradeDiscountPrice; //var upgradeSunText = (TextBox)item.FindControl("UpgradeSunText"); //double.TryParse(upgradeSunText.Text, out upgradeDiscountPrice); //if (!products.UpgradeDiscountSun.Equals(regularPrice)) //{ // updateDefaultPrice = true; //} //products.UpgradeDiscountSun = upgradeDiscountPrice; // Quantity var quantityMonText = (TextBox)item.FindControl("QuantityMonText"); int.TryParse(quantityMonText.Text, out quantity); products.PassCapacityMon = quantity; var quantityTueText = (TextBox)item.FindControl("QuantityTueText"); int.TryParse(quantityTueText.Text, out quantity); products.PassCapacityTue = quantity; var quantityWedText = (TextBox)item.FindControl("QuantityWedText"); int.TryParse(quantityWedText.Text, out quantity); products.PassCapacityWed = quantity; var quantityThuText = (TextBox)item.FindControl("QuantityThuText"); int.TryParse(quantityThuText.Text, out quantity); products.PassCapacityThu = quantity; var quantityFriText = (TextBox)item.FindControl("QuantityFriText"); int.TryParse(quantityFriText.Text, out quantity); products.PassCapacityFri = quantity; var quantitySatText = (TextBox)item.FindControl("QuantitySatText"); int.TryParse(quantitySatText.Text, out quantity); products.PassCapacitySat = quantity; var quantitySunText = (TextBox)item.FindControl("QuantitySunText"); int.TryParse(quantitySunText.Text, out quantity); products.PassCapacitySun = quantity; products.IsUpdateDefaultPrice = updateDefaultPrice; listProducts.Add(products); } _hotelRepository.UpdateDailyPassLimit(listProducts, PublicHotel.TimeZoneId); } _hotelRepository.ResetCache(); ReloadPass(true); saving.InnerText = "Saved!"; saving.Attributes["class"] = "saving"; ClientScript.RegisterClientScriptBlock(GetType(), "hideSaved", "setTimeout(function(){ $('.saving').animate({ opacity: 0 }, 1400, function () { });}, 100);", true); }
protected void rptservice_ItemCommand(object source, RepeaterCommandEventArgs e) { try { var DC = new DataClassesDataContext(); int ID = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Active") { tblAddress result = (from u in DC.tblAddresses where u.AddressID == ID select u).Single(); if (result.IsActive == true) { result.IsActive = false; } else { result.IsActive = true; } DC.SubmitChanges(); } else if (e.CommandName == "View") { var str = (from obj in DC.tblAddresses where obj.AddressID == Convert.ToInt32(e.CommandArgument) select new { data = (from ob in DC.tblServiceProviders where ob.AddressID == obj.AddressID select new { Da = ob.FirstName + " " + ob.LastName }).Take(1).SingleOrDefault().Da, city = (from obj1 in DC.CityMasters where obj1.ID == obj.CityID select new { Da1 = obj1.Name, }).Take(1).SingleOrDefault().Da1, obj.AddressID, obj.Address, obj.Area, obj.CityID, obj.IsActive, obj.Landmark, obj.PincodeNo, }); rptViewDetail.DataSource = str; rptViewDetail.DataBind(); foreach (RepeaterItem item in rptViewDetail.Items) { HiddenField hdn = (HiddenField)item.FindControl("HiddenField1"); Label lblState = (Label)item.FindControl("Label6"); HiddenField hdnState = (HiddenField)item.FindControl("HiddenField3"); if (hdn.Value != "") { var State = (from obj in DC.StateMasters where obj.ID == Convert.ToInt32(hdn.Value) select obj).Single(); lblState.Text = State.Name; hdnState.Value = State.ID.ToString(); } } foreach (RepeaterItem item in rptViewDetail.Items) { HiddenField hdn = (HiddenField)item.FindControl("HiddenField3"); Label lblState = (Label)item.FindControl("Label7"); if (hdn.Value != "") { var Country = (from obj in DC.CountryMasters where obj.ID == Convert.ToInt32(hdn.Value) select obj).Single(); lblState.Text = Country.Name; } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop:'static', keyboard: false});", true); // upModal.Update(); } bindata1(); } catch (Exception ex) { int session = Convert.ToInt32(Session["AdminID"].ToString()); string PageName = System.IO.Path.GetFileName(Request.Url.AbsolutePath); string MACAddress = GetMacAddress(); AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress); ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true); } }
/// <summary> ///چنانچه کلید تایید اعمال تغییرات فشرده شود، نتیجه درخواست های ویرایش مبنی بر تایید یا رد شدن آنها، اعمال می گردد /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void conf_Click(object sender, EventArgs e) { (DTO.TelChanged) = null; (DTO.AddressChanged) = null; (DTO.mobilechanged) = null; (DTO.PostCodeChanged) = null; (DTO.ShahrChanged) = null; (DTO.OstanChanged) = null; var description = string.Empty; var requestIdList = new Dictionary <int, int>(); var editPersonalInformationList = new List <int>(); foreach (RadListViewDataItem lst in rdlv_New.Items) { RadioButton rdb_ConfNewInfo = (RadioButton)lst.FindControl("rdb_ConfNewInfo"); RadioButton rdb_NewInfo = (RadioButton)lst.FindControl("rdb_NewInfo"); Label lbl_EditedID = (Label)lst.FindControl("lbl_EditedID"); Label lbl_NewContent = (Label)lst.FindControl("lbl_NewContent"); TextBox txt_RadEdit = (TextBox)lst.FindControl("txt_RadEdit"); HiddenField hdf_NewContent = (HiddenField)lst.FindControl("hdf_NewContent"); DropDownList ddlCity = (DropDownList)lst.FindControl("ddlCity"); HiddenField hdnStudentRequestID = (HiddenField)lst.FindControl("hdnStudentRequestID"); HiddenField hdnEditPersonalInformation = (HiddenField)lst.FindControl("hdnEditPersonalInformation"); if (rdb_ConfNewInfo.Checked) { if (int.Parse(lbl_EditedID.Text) == 6) { newtel = lbl_NewContent.Text; DTO.TelChanged = true; } if (int.Parse(lbl_EditedID.Text) == 9) { newmobile = lbl_NewContent.Text; DTO.mobilechanged = true; } if (int.Parse(lbl_EditedID.Text) == 8) { newcodeposti = lbl_NewContent.Text; DTO.PostCodeChanged = true; } if (int.Parse(lbl_EditedID.Text) == 11) { //--------------- if (ddlCity != null && ddlCity.Visible == true && ddlCity.SelectedItem.Value != hdf_NewContent.Value.ToString()) { var dtsh = CommonBusiness.getCitiesFromTblShahrestan(int.Parse(hdf_NewContent.Value.ToString())); newshahr = Convert.ToInt32(ddlCity.SelectedItem.Value); var requestCityName = "سایر"; if (dtsh.Rows.Count > 0) { requestCityName = dtsh.Rows[0]["Title"].ToString(); } description = "شهر درخواست از " + requestCityName + " به " + ddlCity.SelectedItem.Text + " تغییر داده شد."; } else { newshahr = (int.Parse(hdf_NewContent.Value.ToString())); } //--------------- DTO.ShahrChanged = true; } if (int.Parse(lbl_EditedID.Text) == 12) { newostan = (int.Parse(hdf_NewContent.Value.ToString())); DTO.OstanChanged = true; } if (int.Parse(lbl_EditedID.Text) == 7) { Addressarg = lbl_NewContent.Text.Split(new char[] { ',' }); newaddress = lbl_NewContent.Text; DTO.AddressChanged = true; } editPersonalInformationList.Add(Convert.ToInt32(hdnEditPersonalInformation.Value)); } if (rdb_NewInfo.Checked) { if (int.Parse(lbl_EditedID.Text) == 6) { DTO.TelChanged = false; DTO.telrad = txt_RadEdit.Text; } if (int.Parse(lbl_EditedID.Text) == 7) { DTO.AddressChanged = false; DTO.addressrad = txt_RadEdit.Text; } if (int.Parse(lbl_EditedID.Text) == 8) { DTO.PostCodeChanged = false; DTO.codepostirad = txt_RadEdit.Text; } if (int.Parse(lbl_EditedID.Text) == 9) { DTO.mobilechanged = false; DTO.mobilerad = txt_RadEdit.Text; } if (int.Parse(lbl_EditedID.Text) == 11) { DTO.ShahrChanged = false; DTO.shahrrad = txt_RadEdit.Text; } if (int.Parse(lbl_EditedID.Text) == 12) { DTO.OstanChanged = false; DTO.ostanrad = txt_RadEdit.Text; } } requestIdList.Add(int.Parse(lbl_EditedID.Text), Convert.ToInt32(hdnStudentRequestID.Value)); } //if(string.IsNullOrEmpty(newshahr)) CommonBusiness cmnb = new CommonBusiness(); //EditBusiness.UpdateEditedInfoFSF2(Session["stcode"].ToString(), newtel, newaddress, newcodeposti, newostan, newshahr, newmobile); foreach (var item in editPersonalInformationList) { EditBusiness.updateStudentInfo(Session["stcode"].ToString(), item); } if (DTO.TelChanged != null && DTO.TelChanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 6, 7, ""); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 6); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 6).Value); } if (DTO.TelChanged != null && DTO.TelChanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 6, 5, DTO.telrad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 6); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 6).Value); } if (DTO.AddressChanged != null && DTO.AddressChanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 7, 7, ""); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 7); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 7).Value); } if (DTO.AddressChanged != null && DTO.AddressChanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 7, 5, DTO.addressrad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 7); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 7).Value); } if (DTO.mobilechanged != null && DTO.mobilechanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 9, 7, ""); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 9); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 9).Value); } if (DTO.mobilechanged != null && DTO.mobilechanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 9, 5, DTO.mobilerad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 9); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 9).Value); } if (DTO.PostCodeChanged != null && DTO.PostCodeChanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 8, 7, ""); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 8); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 8).Value); } if (DTO.PostCodeChanged != null && DTO.PostCodeChanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 8, 5, DTO.codepostirad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 8); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 8).Value); } if (DTO.ShahrChanged != null && DTO.ShahrChanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 11, 7, description); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 11); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 11).Value); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 184, description, requestIdList.FirstOrDefault(f => f.Key == 11).Value); } if (DTO.ShahrChanged != null && DTO.ShahrChanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 11, 5, DTO.shahrrad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 11); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 11).Value); } if (DTO.OstanChanged != null && DTO.OstanChanged == true) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 12, 7, ""); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 7, 12); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 4, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 12).Value); } if (DTO.OstanChanged != null && DTO.OstanChanged == false) { EditBusiness.UpdateIsOk(Session["stcode"].ToString(), 12, 5, DTO.ostanrad.ToString()); EditBusiness.UpdateStudentEditeRequestLogID(Session["stcode"].ToString(), 5, 12); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 5, Session["stcode"].ToString(), requestIdList.FirstOrDefault(f => f.Key == 12).Value); } Response.Redirect("ConfirmEditPersonalInformationUI.aspx?id=" + generaterandomstr(11) + "@A" + Session[sessionNames.menuID].ToString() + "-" + generaterandomstr(2)); }
protected void Page_Load(object sender, EventArgs e) { try { royaltorId = Request.QueryString["RoyaltorId"]; isNewRoyaltor = Request.QueryString["isNewRoyaltor"]; //royaltorId = "12340"; //royaltorId = "27"; //royaltorId = "15829";//no payee //isNewRoyaltor = "N"; if (royaltorId == null || isNewRoyaltor == null) { msgView.SetMessage("Not a valid royaltor!", MessageType.Warning, PositionType.Auto); return; } if (Session["DatabaseName"] != null) { this.Title = Convert.ToString(Session["DatabaseName"]) + " - " + "Royaltor Contract - Payee Supplier Details"; } else { util = new Utilities(); string dbName = util.GetDatabaseName(); util = null; Session["DatabaseName"] = dbName.Split('.')[0].ToString(); this.Title = dbName.Split('.')[0].ToString() + " - " + "Royaltor Contract - Payee Supplier Details"; } lblTab.Focus();//tabbing sequence starts here if (!IsPostBack) { util = new Utilities(); if (util.UserAuthentication()) { //HtmlTableRow trPayeeSuppDetails = (HtmlTableRow)contractNavigationButtons.FindControl("trPayeeSuppDetails"); //trPayeeSuppDetails.Visible = false; Button btnSupplierDetails = (Button)contractNavigationButtons.FindControl("btnSupplierDetails"); btnSupplierDetails.Enabled = false; HiddenField hdnRoyaltorId = (HiddenField)contractNavigationButtons.FindControl("hdnRoyaltorId"); hdnRoyaltorId.Value = royaltorId; HiddenField hdnRoyaltorIdHdr = (HiddenField)contractHdrNavigation.FindControl("hdnRoyaltorId"); hdnRoyaltorIdHdr.Value = royaltorId; //WUIN-599 - resetting the flags ((HiddenField)Master.FindControl("hdnIsContractScreen")).Value = "N"; ((HiddenField)Master.FindControl("hdnIsNotContractScreen")).Value = "N"; this.Master.FindControl("lnkBtnHome").Visible = false; if (isNewRoyaltor == "Y") { btnSave.Text = "Save & Continue"; btnAudit.Text = "Back"; //contractNavigationButtons.DisableForPayeeSupp(); contractNavigationButtons.EnableNewRoyNavButtons(ContractScreens.PayeeSupplier.ToString()); } txtRoyaltor.Text = royaltorId; LoadPayeeSupplierData("-"); //WUIN-450 - If a new Royaltor is set up with Lock checked it should continue to allow entry of the details (the Royaltor set up needs to be completed!) if (isNewRoyaltor != "Y" && contractNavigationButtons.IsRoyaltorLocked(royaltorId)) { btnSave.ToolTip = "Royaltor Locked"; } //WUIN-599 -- Only one user can use contract screens at the same time. // If a contract is already using by another user then making the screen readonly. if (isNewRoyaltor != "Y" && contractNavigationButtons.IsScreenLocked(royaltorId)) { hdnOtherUserScreenLocked.Value = "Y"; } //WUIN-1096 - Only Read access for ReadonlyUser //WUIN-599 If a contract is already using by another user then making the screen readonly. //WUIN-450 -Only Read access for locked contracts if ((Session["UserRole"].ToString().ToLower() == UserRole.ReadOnlyUser.ToString().ToLower()) || (isNewRoyaltor != "Y" && contractNavigationButtons.IsRoyaltorLocked(royaltorId)) || (isNewRoyaltor != "Y" && contractNavigationButtons.IsScreenLocked(royaltorId))) { EnableReadonly(); } } else { ExceptionHandler(util.InvalidUserExpMessage.ToString(), string.Empty); } } } catch (ThreadAbortException ex1) { } catch (Exception ex) { ExceptionHandler("Error in page load.", ex.Message); } }
void gvPreInvoices_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { string tableName = e.Item.OwnerTableView.Name; if (tableName == PreInvoiceTableName) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.EditItem) { DataRowView drv = (DataRowView)e.Item.DataItem; HtmlInputRadioButton rdoDoNothing = e.Item.FindControl("rdoDoNothing") as HtmlInputRadioButton; HtmlInputRadioButton rdoReject = e.Item.FindControl("rdoReject") as HtmlInputRadioButton; HtmlInputRadioButton rdoRegenerate = e.Item.FindControl("rdoRegenerate") as HtmlInputRadioButton; HtmlInputRadioButton rdoApprove = e.Item.FindControl("rdoApprove") as HtmlInputRadioButton; HtmlInputRadioButton rdoApproveAndPost = e.Item.FindControl("rdoApproveAndPost") as HtmlInputRadioButton; DropDownList cboTaxRate = e.Item.FindControl("cboTaxRate") as DropDownList; LinkButton lnkChangeClientReference = (LinkButton)e.Item.FindControl("lnkChangeClientReference"); TextBox txtClientReference = (TextBox)e.Item.FindControl("txtClientReference"); LinkButton lnkSaveClientReference = (LinkButton)e.Item.FindControl("lnkSaveClientReference"); LinkButton lnkCancelClientReference = (LinkButton)e.Item.FindControl("lnkCancelClientReference"); LinkButton lnkChangePurchaseOrderReference = (LinkButton)e.Item.FindControl("lnkChangePurchaseOrderReference"); TextBox txtPurchaseOrderReference = (TextBox)e.Item.FindControl("txtPurchaseOrderReference"); LinkButton lnkSavePurchaseOrderReference = (LinkButton)e.Item.FindControl("lnkSavePurchaseOrderReference"); LinkButton lnkCancelPurchaseOrderReference = (LinkButton)e.Item.FindControl("lnkCancelPurchaseOrderReference"); Label lblNetAmount = e.Item.FindControl("lblNetAmount") as Label; Label lblExtraAmount = e.Item.FindControl("lblExtraAmount") as Label; Label lblFuelSurchargeAmount = e.Item.FindControl("lblFuelSurchargeAmount") as Label; Label lblTaxAmount = e.Item.FindControl("lblTaxAmount") as Label; Label lblTotalAmount = e.Item.FindControl("lblTotalAmount") as Label; HtmlInputCheckBox chkUseHeadedPaper = e.Item.FindControl("chkUseHeadedPaper") as HtmlInputCheckBox; rdoDoNothing.Name += "_" + e.Item.ItemIndex.ToString(); rdoReject.Name += "_" + e.Item.ItemIndex.ToString(); rdoRegenerate.Name += "_" + e.Item.ItemIndex.ToString(); rdoApprove.Name += "_" + e.Item.ItemIndex.ToString(); rdoApproveAndPost.Name += "_" + e.Item.ItemIndex.ToString(); if (this.dsTaxRates == null) { Orchestrator.Facade.Invoice facInvoice = new Orchestrator.Facade.Invoice(); DataSet taxRates = facInvoice.GetTaxRates((DateTime)drv["InvoiceDate"]); this.dsTaxRates = taxRates; } cboTaxRate.DataTextField = "Description"; cboTaxRate.DataValueField = "VatNo"; cboTaxRate.DataSource = this.dsTaxRates; cboTaxRate.DataBind(); cboTaxRate.ClearSelection(); int taxRateID = 0; int.TryParse(drv["TaxRateID"].ToString(), out taxRateID); if (cboTaxRate.Items.FindByValue(taxRateID.ToString()) == null) { ListItem newItem = new ListItem("New Standard", taxRateID.ToString()); cboTaxRate.Items.Add(newItem); } cboTaxRate.Items.FindByValue(taxRateID.ToString()).Selected = true; if (drv["ClientInvoiceReference"] != DBNull.Value) { txtClientReference.Text = lnkChangeClientReference.Text = (string)drv["ClientInvoiceReference"]; } else { txtClientReference.Text = string.Empty; lnkChangeClientReference.Text = "none provided"; } if (drv["PurchaseOrderReference"] != DBNull.Value) { txtPurchaseOrderReference.Text = lnkChangePurchaseOrderReference.Text = (string)drv["PurchaseOrderReference"]; } else { txtPurchaseOrderReference.Text = string.Empty; lnkChangePurchaseOrderReference.Text = "none provided"; } txtPurchaseOrderReference.Visible = lnkSavePurchaseOrderReference.Visible = lnkCancelPurchaseOrderReference.Visible = e.Item.Edit; lnkChangePurchaseOrderReference.Visible = !e.Item.Edit; txtClientReference.Visible = lnkSaveClientReference.Visible = lnkCancelClientReference.Visible = e.Item.Edit; lnkChangeClientReference.Visible = !e.Item.Edit; if ((bool)drv["RequiresRegeneration"]) { rdoApprove.Visible = false; rdoApproveAndPost.Visible = false; rdoRegenerate.Checked = true; } //else // rdoApprove.Checked = true; int lcID = (int)drv["LCID"]; CultureInfo culture = new CultureInfo(lcID); lblNetAmount.Text = ((decimal)drv["ForeignNetAmount"]).ToString("C", culture); lblExtraAmount.Text = ((decimal)drv["ForeignExtraAmount"]).ToString("C", culture); lblFuelSurchargeAmount.Text = ((decimal)drv["ForeignFuelSurchargeAmount"]).ToString("C", culture); lblTaxAmount.Text = ((decimal)drv["ForeignTaxAmount"]).ToString("C", culture); lblTotalAmount.Text = ((decimal)drv["ForeignTotalAmount"]).ToString("C", culture); chkUseHeadedPaper.Checked = Orchestrator.Globals.Configuration.UseHeadedPaper; } else if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Header) { RadioButton rdoDoNothing = e.Item.FindControl("rdoDoNothing") as RadioButton; RadioButton rdoReject = e.Item.FindControl("rdoReject") as RadioButton; RadioButton rdoRegenerate = e.Item.FindControl("rdoRegenerate") as RadioButton; RadioButton rdoApprove = e.Item.FindControl("rdoApprove") as RadioButton; RadioButton rdoApproveAndPost = e.Item.FindControl("rdoApproveAndPost") as RadioButton; rdoDoNothing.GroupName += "_Header"; rdoReject.GroupName += "_Header"; rdoRegenerate.GroupName += "_Header"; rdoApprove.GroupName += "_Header"; rdoApproveAndPost.GroupName += "_Header"; AddReaction(rdoDoNothing, "spnDoNothing"); AddReaction(rdoReject, "spnReject"); AddReaction(rdoRegenerate, "spnRegenerate"); AddReaction(rdoApprove, "spnApprove"); AddReaction(rdoApproveAndPost, "spnApproveAndPost"); //rdoApprove.Checked = true; } } else if (tableName == PreInvoiceItemTableName) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.EditItem) { HiddenField hidOldRate = e.Item.FindControl("hidOldRate") as HiddenField; TextBox txtRate = e.Item.FindControl("txtRate") as TextBox; Label lblPalletSpaces = e.Item.FindControl("lblPalletSpaces") as Label; //LinkButton lnkChangeRate = e.Item.FindControl("lnkChangeRate") as LinkButton; //LinkButton lnkCancelRate = e.Item.FindControl("lnkCancelRate") as LinkButton; //LinkButton lnkSaveRate = e.Item.FindControl("lnkSaveRate") as LinkButton; DataRowView drv = e.Item.DataItem as DataRowView; int itemID = (int)drv["ItemID"]; txtRate.Attributes.Add("ItemID", ((int)drv["ItemID"]).ToString()); int lcID = (int)drv["LCID"]; CultureInfo culture = new CultureInfo(lcID); txtRate.Text = ((decimal)drv["ForeignRate"]).ToString("C", culture); lblPalletSpaces.Text = ((decimal)drv["PalletSpaces"]).ToString("F2"); hidOldRate.Value = ((decimal)drv["ForeignRate"]).ToString("F2"); //txtRate.Visible = e.Item.Edit; //lnkChangeRate.Visible = !e.Item.Edit; // If the item is part of a group only allow the rate to be changed on the first item. //int groupID = (int)drv["GroupID"]; //if (!e.Item.Edit && groupID > 0) //{ // // Is there any item with the same group id but a lower item id? // bool groupAlreadyRendered = // drv.Row.Table.Select(string.Format("GroupID = {0} AND ItemID < {1}", groupID, itemID)). // Length > 0; // //lnkChangeRate.Visible = !groupAlreadyRendered; //} } } }
void gvPreInvoices_ItemCommand(object source, GridCommandEventArgs e) { string userName = ((Entities.CustomPrincipal)Page.User).UserName; switch (e.CommandName.ToLower()) { #region Client Reference Editing case "cancelclientreference": e.Item.Edit = false; gvPreInvoices.Rebind(); break; case "editclientreference": e.Item.Edit = true; gvPreInvoices.Rebind(); break; case "editpurchaseorderreference": e.Item.Edit = true; gvPreInvoices.Rebind(); break; case "updateclientreference": e.Item.Edit = false; string clientReference = string.Empty; LinkButton lnkChangeClientReference = e.Item.FindControl("lnkChangeClientReference") as LinkButton; TextBox txtClientReference = e.Item.FindControl("txtClientReference") as TextBox; if (lnkChangeClientReference != null && txtClientReference != null) { string oldClientReference = lnkChangeClientReference.Text; clientReference = txtClientReference.Text; // Only apply the change if the client reference has been altered if (oldClientReference != clientReference) { // Update the client reference int preInvoiceID = int.Parse(((GridDataItem)e.Item).GetDataKeyValue("PreInvoiceID").ToString()); Facade.IPreInvoice facPreInvoice = new Facade.PreInvoice(); facPreInvoice.UpdateClientInvoiceReference(preInvoiceID, clientReference, userName); } } gvPreInvoices.Rebind(); break; case "updatepurchaseorderreference": e.Item.Edit = false; string purchaseOrderReference = string.Empty; LinkButton lnkChangePurchaseOrderReference = e.Item.FindControl("lnkChangePurchaseOrderReference") as LinkButton; TextBox txtPurchaseOrderReference = e.Item.FindControl("txtPurchaseOrderReference") as TextBox; if (lnkChangePurchaseOrderReference != null && txtPurchaseOrderReference != null) { string oldPurchaseOrderReference = lnkChangePurchaseOrderReference.Text; purchaseOrderReference = txtPurchaseOrderReference.Text; // Only apply the change if the client reference has been altered if (oldPurchaseOrderReference != purchaseOrderReference) { // Update the client reference int preInvoiceID = int.Parse(((GridDataItem)e.Item).GetDataKeyValue("PreInvoiceID").ToString()); Facade.IPreInvoice facPreInvoice = new Facade.PreInvoice(); facPreInvoice.UpdatePurchaseOrderReference(preInvoiceID, purchaseOrderReference, userName); } } gvPreInvoices.Rebind(); break; #endregion #region Rate Editing //case "cancelrate": // e.Item.Edit = false; // e.Item.OwnerTableView.Rebind(); // gvPreInvoices.MasterTableView.Rebind(); // StayOpen = e.Item.OwnerTableView.ParentItem.ItemIndex; // break; //case "editrate": // e.Item.Edit = true; // e.Item.OwnerTableView.Rebind(); // gvPreInvoices.MasterTableView.Rebind(); // StayOpen = e.Item.OwnerTableView.ParentItem.ItemIndex; // break; case "update": // update rate and pallet spaces. e.Item.Edit = false; decimal rate = 0; //LinkButton lnkChangeRate = e.Item.FindControl("lnkChangeRate") as LinkButton; HiddenField hidOldRate = e.Item.FindControl("hidOldRate") as HiddenField; TextBox txtRate = e.Item.FindControl("txtRate") as TextBox; GridDataItem parentItem = e.Item.OwnerTableView.ParentItem; int lcid = int.Parse(parentItem.GetDataKeyValue("LCID").ToString()); CultureInfo preInvoiceCulture = new CultureInfo(lcid); if (Decimal.TryParse(txtRate.Text, System.Globalization.NumberStyles.Currency, preInvoiceCulture, out rate)) { decimal oldRate = 0; oldRate = decimal.Parse(hidOldRate.Value); // Only apply the rate change if the rate has altered. if (oldRate != rate) { int itemID = int.Parse(txtRate.Attributes["ItemID"]); // Update the rate (depends on item type - depends on invoice type) int preInvoiceID = int.Parse(parentItem.GetDataKeyValue("PreInvoiceID").ToString()); eInvoiceType invoiceType = (eInvoiceType)int.Parse(parentItem.GetDataKeyValue("InvoiceTypeID").ToString()); CultureInfo culture = new CultureInfo(Orchestrator.Globals.Configuration.NativeCulture); Facade.IPreInvoice facPreInvoice = new Facade.PreInvoice(); Facade.IExchangeRates facER = new Facade.ExchangeRates(); switch (invoiceType) { case eInvoiceType.ClientInvoicing: Facade.IOrder facOrder = new Facade.Order(); Entities.Order order = facOrder.GetForOrderID(itemID); order.ForeignRate = rate; if (order.LCID != culture.LCID) { BusinessLogicLayer.IExchangeRates blER = new BusinessLogicLayer.ExchangeRates(); BusinessLogicLayer.CurrencyConverter currencyConverter = blER.CreateCurrencyConverter(order.LCID, order.CollectionDateTime); order.Rate = currencyConverter.ConvertToLocal(order.ForeignRate); } else { order.Rate = decimal.Round(order.ForeignRate, 4, MidpointRounding.AwayFromZero); } //if (order.OrderGroupID > 0) //facPreInvoice.UpdateOrderGroupRate(preInvoiceID, order.OrderGroupID, order.ForeignRate, order.Rate, userName); //else facPreInvoice.UpdateOrderRate(preInvoiceID, itemID, order.ForeignRate, order.Rate, userName); break; case eInvoiceType.SubContractorSelfBill: case eInvoiceType.SubContract: // Needs to be Amended For Currency : TL 12/05/08; Facade.IJobSubContractor facJSC = new Facade.Job(); Entities.JobSubContractor jobSubContractor = facJSC.GetSubContractorForJobSubContractId(itemID); jobSubContractor.ForeignRate = rate; if (jobSubContractor.LCID != culture.LCID) { jobSubContractor.Rate = facER.GetConvertedRate((int)jobSubContractor.ExchangeRateID, jobSubContractor.ForeignRate); } else { jobSubContractor.Rate = decimal.Round(jobSubContractor.ForeignRate, 4, MidpointRounding.AwayFromZero); } facPreInvoice.UpdateJobSubContractRate(preInvoiceID, itemID, jobSubContractor.ForeignRate, jobSubContractor.Rate, jobSubContractor.ExchangeRateID, userName); break; default: throw new NotSupportedException("You can not alter item rates on invoices of type " + invoiceType.ToString()); } this.lblSavedMessage.Text = string.Format("Your changes were saved at {0}", DateTime.Now.ToLongTimeString()); } } e.Item.OwnerTableView.Rebind(); gvPreInvoices.MasterTableView.Rebind(); StayOpen = parentItem.ItemIndex; break; #endregion } }
protected void GvAllowanceClaculateMaster_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Selecta") { #region SELECT ROW // clear(); int id = int.Parse(e.CommandArgument.ToString()); Control ctrl = e.CommandSource as Control; if (ctrl != null) { GridViewRow row = ctrl.Parent.NamingContainer as GridViewRow; HiddenField HfCompCodeGrid = (row.FindControl("HfCompCodeGrid")) as HiddenField; HiddenField HfTranTypeGrid = (row.FindControl("HfTranTypeGrid")) as HiddenField; DataTable dt = GENERAL_MASLogicLayer.GetAllIDWiseGENERAL_MASDetials(HfCompCodeGrid.Value.Trim().ToString(), e.CommandArgument.ToString(), HfTranTypeGrid.Value.Trim().ToString()); if (dt.Rows.Count > 0) { HfCompCode.Value = dt.Rows[0]["COMP_CODE"].ToString(); HfTranNo.Value = dt.Rows[0]["TRAN_NO"].ToString(); HfTranType.Value = dt.Rows[0]["TRAN_TYPE"].ToString(); TxtAllowanceFromDate.Text = dt.Rows[0]["FRDT"].ToString(); TxtAllowanceToDate.Text = dt.Rows[0]["TODT"].ToString(); TxtAllowanceCalculateHours.Text = dt.Rows[0]["CAL_HOURS"].ToString(); TxtAllowanceCalculateRate1.Text = dt.Rows[0]["CAL_RATE1"].ToString(); BtnSaveAllowanceData.Text = "UPDATE"; } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowModelSaveAllowance", "ShowModelSaveAllowance()", true); } #endregion } if (e.CommandName == "Deletea") { #region SELECT ROW // clear(); int id = int.Parse(e.CommandArgument.ToString()); Control ctrl = e.CommandSource as Control; if (ctrl != null) { GridViewRow row = ctrl.Parent.NamingContainer as GridViewRow; HiddenField HfCompCodeGrid = (row.FindControl("HfCompCodeGrid")) as HiddenField; HiddenField HfTranTypeGrid = (row.FindControl("HfTranTypeGrid")) as HiddenField; DataTable dt = GENERAL_MASLogicLayer.GetAllIDWiseGENERAL_MASDetials(HfCompCodeGrid.Value.Trim().ToString(), e.CommandArgument.ToString(), HfTranTypeGrid.Value.Trim().ToString()); if (dt.Rows.Count > 0) { HfCompCode.Value = dt.Rows[0]["COMP_CODE"].ToString(); HfTranNo.Value = dt.Rows[0]["TRAN_NO"].ToString(); HfTranType.Value = dt.Rows[0]["TRAN_TYPE"].ToString(); TxtAllowanceFromDate.Text = dt.Rows[0]["FRDT"].ToString(); TxtAllowanceToDate.Text = dt.Rows[0]["TODT"].ToString(); TxtAllowanceCalculateHours.Text = dt.Rows[0]["CAL_HOURS"].ToString(); TxtAllowanceCalculateRate1.Text = dt.Rows[0]["CAL_RATE1"].ToString(); } } #endregion ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowModelDeleteAllowance", "ShowModelDeleteAllowance()", true); } } catch (Exception) { throw; } }
/// <summary> /// Creates the person. /// </summary> /// <returns></returns> private Person CreatePerson() { var rockContext = new RockContext(); DefinedValueCache dvcConnectionStatus = DefinedValueCache.Read(GetAttributeValue("ConnectionStatus").AsGuid()); DefinedValueCache dvcRecordStatus = DefinedValueCache.Read(GetAttributeValue("RecordStatus").AsGuid()); Person person = new Person(); person.FirstName = tbFirstName.Text; person.LastName = tbLastName.Text; person.Email = tbEmail.Text; person.IsEmailActive = true; person.EmailPreference = EmailPreference.EmailAllowed; person.RecordTypeValueId = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.PERSON_RECORD_TYPE_PERSON.AsGuid()).Id; if (dvcConnectionStatus != null) { person.ConnectionStatusValueId = dvcConnectionStatus.Id; } if (dvcRecordStatus != null) { person.RecordStatusValueId = dvcRecordStatus.Id; } switch (ddlGender.SelectedValue) { case "M": person.Gender = Gender.Male; break; case "F": person.Gender = Gender.Female; break; default: person.Gender = Gender.Unknown; break; } var birthday = bdaypBirthDay.SelectedDate; if (birthday.HasValue) { person.BirthMonth = birthday.Value.Month; person.BirthDay = birthday.Value.Day; if (birthday.Value.Year != DateTime.MinValue.Year) { person.BirthYear = birthday.Value.Year; } } bool smsSelected = false; foreach (RepeaterItem item in rPhoneNumbers.Items) { HiddenField hfPhoneType = item.FindControl("hfPhoneType") as HiddenField; PhoneNumberBox pnbPhone = item.FindControl("pnbPhone") as PhoneNumberBox; CheckBox cbUnlisted = item.FindControl("cbUnlisted") as CheckBox; CheckBox cbSms = item.FindControl("cbSms") as CheckBox; if (!string.IsNullOrWhiteSpace(PhoneNumber.CleanNumber(pnbPhone.Number))) { int phoneNumberTypeId; if (int.TryParse(hfPhoneType.Value, out phoneNumberTypeId)) { var phoneNumber = new PhoneNumber { NumberTypeValueId = phoneNumberTypeId }; person.PhoneNumbers.Add(phoneNumber); phoneNumber.CountryCode = PhoneNumber.CleanNumber(pnbPhone.CountryCode); phoneNumber.Number = PhoneNumber.CleanNumber(pnbPhone.Number); // Only allow one number to have SMS selected if (smsSelected) { phoneNumber.IsMessagingEnabled = false; } else { phoneNumber.IsMessagingEnabled = cbSms.Checked; smsSelected = cbSms.Checked; } phoneNumber.IsUnlisted = cbUnlisted.Checked; } } } PersonService.SaveNewPerson(person, rockContext, null, false); // save address if (pnlAddress.Visible) { if (acAddress.IsValid && !string.IsNullOrWhiteSpace(acAddress.Street1) && !string.IsNullOrWhiteSpace(acAddress.City) && !string.IsNullOrWhiteSpace(acAddress.PostalCode)) { Guid locationTypeGuid = GetAttributeValue("LocationType").AsGuid(); if (locationTypeGuid != Guid.Empty) { Guid familyGroupTypeGuid = Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid(); GroupService groupService = new GroupService(rockContext); GroupLocationService groupLocationService = new GroupLocationService(rockContext); var family = groupService.Queryable().Where(g => g.GroupType.Guid == familyGroupTypeGuid && g.Members.Any(m => m.PersonId == person.Id)).FirstOrDefault(); var groupLocation = new GroupLocation(); groupLocation.GroupId = family.Id; groupLocationService.Add(groupLocation); var location = new LocationService(rockContext).Get(acAddress.Street1, acAddress.Street2, acAddress.City, acAddress.State, acAddress.PostalCode, acAddress.Country); groupLocation.Location = location; groupLocation.GroupLocationTypeValueId = DefinedValueCache.Read(locationTypeGuid).Id; groupLocation.IsMailingLocation = true; groupLocation.IsMappedLocation = true; rockContext.SaveChanges(); } } } return(person); }
protected void cmdSubmit_Click(object sender, EventArgs e) { try { DataSet objds = null; if (Cache["NoMvoeSalesToFin"] != null) { objds = (DataSet)(Cache["NoMvoeSalesToFin"]); } foreach (GridViewRow row in gdvFlightBookings.Rows) { CheckBox chk = row.Cells[0].Controls[1] as CheckBox; HiddenField hf = row.Cells[0].Controls[3] as HiddenField; if (chk != null && chk.Checked) { // Use the Select method to find all rows matching the filter. if (objds.Tables[0].Rows.Count > 0) { var strExpr = "FlightRequestId = " + hf.Value; var strSort = "FlightRequestId DESC"; var foundRows = objds.Tables[0].Select(strExpr, strSort); if (foundRows.Length > 0) { T5BookingHeader objT5BookingHeader = new T5BookingHeader(); objT5BookingHeader.PlatingCarrier = foundRows[0]["PlatingCarrier"].ToString(); objT5BookingHeader.airline_name = foundRows[0]["airline_name"].ToString(); objT5BookingHeader.PseudoCityCode = foundRows[0]["PseudoCityCode"].ToString(); objT5BookingHeader.ProviderLocatorCode = foundRows[0]["ProviderLocatorCode"].ToString(); objT5BookingHeader.TotalPriceCurrencyCode = foundRows[0]["TotalPriceCurrencyCode"].ToString(); objT5BookingHeader.TotalPrice = foundRows[0]["TotalPrice"].ToString().Replace(".", string.Empty).Trim(); objT5BookingHeader.FileNo = foundRows[0]["FileNo"].ToString(); objT5BookingHeader.FlightDate = objBOUtiltiy.ReverseConvertDateFormat(foundRows[0]["FlightDate"].ToString(), "ddMMMyy").ToUpper(); objT5BookingHeader.FlightReturnDate = objBOUtiltiy.ReverseConvertDateFormat(foundRows[0]["FlightReturnDate"].ToString(), "ddMMMyy").ToUpper(); objT5BookingHeader.CntCode = foundRows[0]["UserCode"].ToString() != "" ? foundRows[0]["UserCode"].ToString() : "Mh"; objT5BookingHeader.PaxName = foundRows[0]["paxname"].ToString(); objT5BookingHeader.ExcluAmount = foundRows[0]["ServiceFee"].ToString(); objT5BookingHeader.VatAmount = foundRows[0]["VatFee"].ToString(); objT5BookingHeader.ClientTot = foundRows[0]["ChargeServiceFee"].ToString(); objT5BookingHeader.VatPer = 0; objT5BookingHeader.PaymentMethod = foundRows[0]["paymenttype"].ToString() != "Cash" ? "1" : "2"; int FlightRequestId = Convert.ToInt32(foundRows[0]["FlightRequestId"]); int UerLoginId = Convert.ToInt32(foundRows[0]["UserLoginId"]); int UserRole = Convert.ToInt32(foundRows[0]["UserRole"]); int Eticket = Convert.ToInt32(foundRows[0]["EticketBy"]); string PaxName = foundRows[0]["paxname"].ToString(); string PaxEmail = foundRows[0]["PaxEmail"].ToString(); string PaxMobile = foundRows[0]["PaxMobile"].ToString(); string UserName = foundRows[0]["UserName"].ToString(); string UserEmail = foundRows[0]["UserPhone"].ToString(); string UserPhone = foundRows[0]["UserPhone"].ToString(); string UserCode = foundRows[0]["UserCode"].ToString(); int nResult = objBALSalesIntegration.InsertUpdateT5BookingHeader(objT5BookingHeader); if (nResult > 0) { DataSet ObjdsAll = null; if (UserRole != 3) { ObjdsAll = objBALFinSales.GetAllSalesDetails(FlightRequestId, nResult, UerLoginId, UserRole); objBALSalesIntegration.BatchBulkCopyPassenger(ObjdsAll.Tables[0], "a02_passenger_det"); objBALSalesIntegration.BatchBulkCopyAirLineDetails(ObjdsAll.Tables[1], "a04_airline_det"); objBALSalesIntegration.BatchBulkCopyFairDetails(ObjdsAll.Tables[2], "a07_fare_value_det"); string EmployeeName = ObjdsAll.Tables[3].Rows[0]["UserName"].ToString(); string EmployeeEmail = ObjdsAll.Tables[3].Rows[0]["UserEmail"].ToString(); string EmployeePhone = ObjdsAll.Tables[3].Rows[0]["UserPhone"].ToString(); string EmployeeCode = ObjdsAll.Tables[3].Rows[0]["UserCode"].ToString(); int nEmpResult = objBALSalesIntegration.InsertUpdateEmployee(EmployeeName, EmployeeEmail, EmployeePhone, EmployeeCode, nResult); int nCrpResult = objBALSalesIntegration.InsertUpdateClients(3, PaxName, PaxEmail, PaxMobile, nResult); } else { ObjdsAll = objBALFinSales.GetAllSalesDetails(FlightRequestId, nResult, Eticket, UserRole); objBALSalesIntegration.BatchBulkCopyPassenger(ObjdsAll.Tables[0], "a02_passenger_det"); objBALSalesIntegration.BatchBulkCopyAirLineDetails(ObjdsAll.Tables[1], "a04_airline_det"); objBALSalesIntegration.BatchBulkCopyFairDetails(ObjdsAll.Tables[2], "a07_fare_value_det"); string EmployeeName = ObjdsAll.Tables[3].Rows[0]["UserName"].ToString(); string EmployeeEmail = ObjdsAll.Tables[3].Rows[0]["UserEmail"].ToString(); string EmployeePhone = ObjdsAll.Tables[3].Rows[0]["UserPhone"].ToString(); string EmployeeCode = ObjdsAll.Tables[3].Rows[0]["UserCode"].ToString(); int nEmpResult = objBALSalesIntegration.InsertUpdateEmployee(EmployeeName, EmployeeEmail, EmployeePhone, EmployeeCode, nResult); int nCrpResult = objBALSalesIntegration.InsertUpdateClients(3, UserName, UserEmail, UserPhone, nResult); } objBALFinSales.UpdateMoveToFinance(FlightRequestId); BindBookings(); } } } } } } catch (Exception ex) { lblMsg.Text = objBOUtiltiy.ShowMessage("danger", "Error", ex.Message); } }
/// <summary> /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param> public override void RenderControl(HtmlTextWriter writer) { HiddenField hfFilter = new HiddenField(); hfFilter.ID = this.ID + "_hSearchFilter"; var searchExtensions = new Dictionary <string, Tuple <string, string> >(); var rockPage = this.Page as RockPage; if (rockPage != null) { foreach (KeyValuePair <int, Lazy <Rock.Search.SearchComponent, Rock.Extension.IComponentData> > service in Rock.Search.SearchContainer.Instance.Components) { var searchComponent = service.Value.Value; if (searchComponent.IsAuthorized(Authorization.VIEW, rockPage.CurrentPerson)) { if (!searchComponent.AttributeValues.ContainsKey("Active") || bool.Parse(searchComponent.AttributeValues["Active"].Value)) { searchExtensions.Add(service.Key.ToString(), Tuple.Create <string, string>(searchComponent.SearchLabel, searchComponent.ResultUrl)); if (string.IsNullOrWhiteSpace(hfFilter.Value)) { hfFilter.Value = service.Key.ToString(); } } } } } writer.AddAttribute("class", "smartsearch " + this.CssClass); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "fa fa-search"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.AddAttribute("class", "nav pull-right smartsearch-type"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); writer.AddAttribute("class", "dropdown"); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute("class", "dropdown-toggle navbar-link"); writer.AddAttribute("data-toggle", "dropdown"); writer.RenderBeginTag(HtmlTextWriterTag.A); // wrap item in span for css hook writer.RenderBeginTag(HtmlTextWriterTag.Span); if (searchExtensions.ContainsKey(hfFilter.Value)) { writer.Write(searchExtensions[hfFilter.Value].Item1); } writer.RenderEndTag(); // add carat writer.AddAttribute("class", "fa fa-caret-down"); writer.RenderBeginTag(HtmlTextWriterTag.B); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute("class", "dropdown-menu"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); foreach (var searchExtension in searchExtensions) { writer.AddAttribute("data-key", searchExtension.Key); writer.AddAttribute("data-target", searchExtension.Value.Item2); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(searchExtension.Value.Item1); writer.RenderEndTag(); writer.RenderEndTag(); } writer.RenderEndTag(); //ul writer.RenderEndTag(); //li writer.RenderEndTag(); //ul base.RenderControl(writer); hfFilter.RenderControl(writer); writer.RenderEndTag(); //div }
private void Layout(Panel Container, HiddenField Field, DataForm Form) { // Do nothing }
protected void btnDelivery_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (string.IsNullOrEmpty(fname.Value.Trim())) { lblName.Visible = true; fname.Focus(); return; } else { lblName.Visible = false; } if (string.IsNullOrEmpty(email.Value.Trim())) { lblEmail.Visible = true; email.Focus(); return; } else { lblEmail.Visible = false; } if (string.IsNullOrEmpty(adr.Value.Trim())) { lblTel.Visible = true; adr.Focus(); return; } else { lblTel.Visible = false; } if (string.IsNullOrEmpty(city.Value.Trim())) { lblAddress.Visible = true; city.Focus(); return; } else { lblAddress.Visible = false; } Hashtable htData = new Hashtable(); for (int i = 0; i < rptCart.Items.Count; i++) { RepeaterItem item = rptCart.Items[i]; TextBox txtquantity = (TextBox)item.FindControl("txtquantity"); DropDownList ddlSize = (DropDownList)item.FindControl("ddlSize"); HiddenField hfId = (HiddenField)item.FindControl("hfId"); htData.Add(hfId.Value.Trim(), txtquantity.Text.Trim() + "," + ddlSize.SelectedValue); } Orders order = new Orders(); order.Id = Id; order.Name = StringClass.SqlInjection(fname.Value.Trim()); order.Email = StringClass.SqlInjection(email.Value.Trim()); order.Tel = StringClass.SqlInjection(adr.Value.Trim()); order.Address = StringClass.SqlInjection(city.Value.Trim()); order.OrderId = orderId; order.OrderDate = DateTimeClass.ConvertDateTime(DateTime.Now, "dd/MM/yyyy HH:mm:ss"); if (rdoChuyenkhoan.Checked) { order.PaymentMethod = "0"; } else { order.PaymentMethod = "1"; } order.Price = totalPrice; order.Status = "1"; order.Detail = StringClass.SqlInjection(content.Value.Trim()); order.DeliveryDate = ""; OrdersService.PurchaseProduct(order, htData); lblMsg.Text = "Cảm ơn bạn đã mua sản phẩm của chúng tôi. Chúng tôi sẽ giao hàng trong thời gian sớm nhất."; shoppingcart.Visible = false; rptCart.Visible = false; } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
protected void RadGridCostSheets_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is DataRowView) { DataRowView objPrice = (DataRowView)item.DataItem; HyperLink hlCostSheet = (HyperLink)item.FindControl("hlCostSheet"); hlCostSheet.Text = objPrice["CostSheetId"].ToString(); hlCostSheet.NavigateUrl = "../AddEditFactoryCostSheet.aspx?id=" + objPrice["CostSheetId"].ToString(); Literal litFabricCost = (Literal)item.FindControl("litFabricCost"); litFabricCost.Text = "$" + objPrice["FabricPrice"].ToString(); Literal litIndimanPrice = (Literal)item.FindControl("litIndimanPrice"); litIndimanPrice.Text = "$" + ((this.DisplayMarginRates && !this.IsFOB) ? string.Empty : objPrice["IndimanPrice"].ToString()); TextBox txtIndimanPrice = (TextBox)item.FindControl("txtIndimanPrice"); txtIndimanPrice.Text = objPrice["IndimanPrice"].ToString(); txtIndimanPrice.Visible = this.DisplayMarginRates && !this.IsFOB; HiddenField hdnCSID = (HiddenField)e.Item.FindControl("hdnCSID"); hdnCSID.Value = objPrice["CostSheetId"].ToString(); Literal litActMgn = (Literal)item.FindControl("litActMgn"); litActMgn.Text = "$" + objPrice["ActMgn"].ToString(); Literal litQuotedMp = (Literal)item.FindControl("litQuotedMp"); litQuotedMp.Text = objPrice["QuotedMp"].ToString() + "%"; Literal litFOBCost = (Literal)item.FindControl("litFOBCost"); litFOBCost.Text = "$" + objPrice["FOBCost"].ToString(); Literal litQuotedFOBPrice = (Literal)item.FindControl("litQuotedFOBPrice"); litQuotedFOBPrice.Text = "$" + objPrice["QuotedFOBPrice"].ToString(); DateTime dtModified = DateTime.Parse(objPrice["ModifiedDate"].ToString()); if (dtModified.Year != 1900) { Literal litModifiedDate = (Literal)item.FindControl("litModifiedDate"); litModifiedDate.Text = dtModified.ToShortDateString(); } int column = 18; if (DisplayPriceLevels) { List <PriceLevelNewBO> lstPriceLevels = new PriceLevelNewBO().SearchObjects(); foreach (PriceLevelNewBO objLevel in lstPriceLevels) { item.Cells[column].Text = objPrice[objLevel.Volume.Replace(' ', '_')].ToString(); //"$" + ((objPrice.IndimanPrice ?? 0) / Convert.ToDecimal(((100 - objLevel.Markup) / 100))).ToString("0.00"); item.Cells[column++].HorizontalAlign = HorizontalAlign.Right; } TextBox txtPrice = new TextBox(); txtPrice.ID = "txtPrice"; txtPrice.Width = Unit.Pixel(50); txtPrice.CssClass = "iWhatPrice"; item["WhatPrice"].Controls.Add(txtPrice); TextBox txtPercentage = new TextBox(); txtPercentage.ID = "txtPercentage"; txtPercentage.Width = Unit.Pixel(50); txtPercentage.CssClass = "iWhatPercentage"; item["WhatPercentage"].Controls.Add(txtPercentage); } } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType.Equals(DataControlRowType.Header)) { for (int iCol = 0; iCol < e.Row.Cells.Count; iCol++) { e.Row.Cells[iCol].Attributes.Add("class", "table_h"); e.Row.Cells[iCol].Wrap = false; } } else if (e.Row.RowType.Equals(DataControlRowType.DataRow) || e.Row.RowState.Equals(DataControlRowState.Alternate)) { #region Set datagrid row color string strEvenColor, strOddColor, strMouseOverColor; strEvenColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Even"].ToString(); strOddColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Odd"].ToString(); strMouseOverColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["MouseOver"].ToString(); e.Row.Style.Add("valign", "top"); e.Row.Style.Add("cursor", "hand"); e.Row.Attributes.Add("onMouseOver", "this.style.backgroundColor='" + strMouseOverColor + "'"); if (e.Row.RowState.Equals(DataControlRowState.Alternate)) { e.Row.Attributes.Add("bgcolor", strOddColor); e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strOddColor + "'"); } else { e.Row.Attributes.Add("bgcolor", strEvenColor); e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strEvenColor + "'"); } #endregion Label lblNo = (Label)e.Row.FindControl("lblNo"); int nNo = (GridView1.PageSize * GridView1.PageIndex) + e.Row.RowIndex + 1; lblNo.Text = nNo.ToString(); Label lblmaterial_name = (Label)e.Row.FindControl("lblmaterial_name"); LinkButton lblmaterial_code = (LinkButton)e.Row.FindControl("lblmaterial_code"); HiddenField hddmaterial_id = (HiddenField)e.Row.FindControl("hddmaterial_id"); if (!ViewState["show"].ToString().Equals("1")) { string strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].$('#" + ViewState["ctrl1"].ToString() + "').val('" + lblmaterial_code.Text + "');\n " + "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].$('#" + ViewState["ctrl2"].ToString() + "').val('" + lblmaterial_name.Text + "');\n" + "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].$('#" + ViewState["ctrl3"].ToString() + "').val('" + hddmaterial_id.Value.ToString() + "');\n"; strScript += "ClosePopUp('" + ViewState["show"].ToString() + "');"; lblmaterial_code.Attributes.Add("onclick", strScript); } else { string strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + lblmaterial_code.Text + "';\n " + "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + lblmaterial_name.Text + "';\n" + "window.parent.document.getElementById('" + ViewState["ctrl3"].ToString() + "').value='" + hddmaterial_id.Value.ToString() + "';\n"; strScript += "ClosePopUp('" + ViewState["show"].ToString() + "');"; lblmaterial_code.Attributes.Add("onclick", strScript); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString.HasKeys()) { string numTemplates = Request.QueryString["HD_NumberTemplates"]; // Get the number of templates that remain to be uploaded. int.TryParse(numTemplates, out RemainingTemplates); // If this is the first time at the page, the number of remaining templates is the same as the total number of templates. if (string.IsNullOrEmpty(TotalTemplateCount.Value)) { TotalTemplateCount.Value = RemainingTemplates.ToString(); SuccessfulUploadItems.Clear(); ConflictUploadItems.Clear(); CanceledUploadItems.Clear(); } TotalNumTemplates = int.Parse(TotalTemplateCount.Value); } UpdatePanelVisibility(); if (RemainingTemplates > 0) { UploadedTemplatesGrid.Rows.Clear(); for (int i = 0; i < GridSize; i++) { System.Web.UI.HtmlControls.HtmlTableRow tr = new System.Web.UI.HtmlControls.HtmlTableRow(); System.Web.UI.HtmlControls.HtmlTableCell tc; // Template Title tc = new System.Web.UI.HtmlControls.HtmlTableCell(); tc.Width = "30%"; TextBox templateTitle = new TextBox(); templateTitle.ID = string.Format("HD_Template_Title{0}", i.ToString()); templateTitle.Rows = 3; templateTitle.TextMode = TextBoxMode.MultiLine; tc.Controls.Add(templateTitle); tr.Controls.Add(tc); // Template Description tc = new System.Web.UI.HtmlControls.HtmlTableCell(); tc.Width = "70%"; TextBox templateDescription = new TextBox(); templateDescription.ID = string.Format("HD_Template_Description{0}", i.ToString()); templateDescription.Rows = 3; templateDescription.TextMode = TextBoxMode.MultiLine; tc.Controls.Add(templateDescription); tr.Controls.Add(tc); // Hidden controls tc = new System.Web.UI.HtmlControls.HtmlTableCell(); tc.Style.Add("display", "none"); // The upload item type can be a template, a file, or a URL. This field is utilized by HotDocs 11 (and later). The // Upload plugin for HotDocs 10 does not set this field. HiddenField uploadItemType = new HiddenField(); uploadItemType.ID = "HD_Template_UploadItemType" + i; tc.Controls.Add(uploadItemType); // Main Template File Name HiddenField templateMain = new HiddenField(); templateMain.ID = "HD_Template_FileName" + i; tc.Controls.Add(templateMain); HiddenField libraryPath = new HiddenField(); libraryPath.ID = "HD_Template_Library_Path" + i; tc.Controls.Add(libraryPath); HiddenField expirationDate = new HiddenField(); expirationDate.ID = "HD_Template_Expiration_Date" + i; tc.Controls.Add(expirationDate); HiddenField expirationWarningDays = new HiddenField(); expirationWarningDays.ID = "HD_Template_Warning_Days" + i; tc.Controls.Add(expirationWarningDays); HiddenField expirationExtensionDays = new HiddenField(); expirationExtensionDays.ID = "HD_Template_Extension_Days" + i; tc.Controls.Add(expirationExtensionDays); HiddenField commandLineSwitches = new HiddenField(); commandLineSwitches.ID = "HD_Template_CommandLineSwitches" + i; tc.Controls.Add(commandLineSwitches); // Template package file upload control FileUpload ulCtrl = new FileUpload(); ulCtrl.ID = string.Format("HD_Upload{0}", i.ToString()); tc.Controls.Add(ulCtrl); // Template manifest file upload control FileUpload ulPackageManifestXML = new FileUpload(); ulPackageManifestXML.ID = string.Format("HD_Package_Manifest{0}", i.ToString()); tc.Controls.Add(ulPackageManifestXML); tr.Controls.Add(tc); UploadedTemplatesGrid.Rows.Add(tr); } if (GridSize > 1) submitBtn.Text = string.Format("Upload Templates {0}-{1} of {2}", (TotalNumTemplates - RemainingTemplates) + 1, GridSize, TotalNumTemplates); else submitBtn.Text = string.Format("Upload Template {0} of {1}", (TotalNumTemplates - RemainingTemplates) + 1, TotalNumTemplates); } if (Request.Files.Count > 0) { int templateIndex = 0; int fileIndex = 0; while (fileIndex < Request.Files.Count) { HttpPostedFile postedFile = Request.Files[fileIndex]; if (postedFile.ContentLength > 0 && !string.IsNullOrEmpty(postedFile.FileName)) { FileInfo finfo = new FileInfo(postedFile.FileName); if (finfo.Extension.ToLower() != ".xml") { string ext = Path.GetExtension(postedFile.FileName).ToLower(); string baseFileName = Path.GetFileNameWithoutExtension(postedFile.FileName); // note: there are three possibilities here: // 1) The fileName is a template package, formatted <guid>.pkg // 2) The fileName is a url, formatted <guid>.url // 3) The filename is a raw file, formatted with the a non-guid base file name and extension: // Note: Here in this sample portal we ignore 2) and 3) because we are only concerned // with uploading templates: if (!IsGuid(baseFileName) || ext == ".url") { return; } string packageID = baseFileName; string packagePath = PackageCache.GetLocalPackagePath(packageID); if (!string.IsNullOrEmpty(packageID)) { FileStream fs = File.OpenWrite(packagePath); postedFile.InputStream.CopyTo(fs); fs.Close(); UploadItem infoItem = new UploadItem { Title = Request.Form["HD_Template_Title" + templateIndex], Description = Request.Form["HD_Template_Description" + templateIndex], MainTemplateFileName = Request.Form["HD_Template_FileName" + templateIndex], /// LibraryPath is an optional field that is intended to give this portal an indication /// of where the current template was stored in the user's HotDocs library on the desktop. /// This Sample Portal application does not save this value, and it is included /// here as sample code. LibraryPath = Request.Form["HD_Library_Path" + templateIndex], /// CommandLineSwitches is an optional field that contains any command line parameters /// that were used for the current template with the desktop HotDocs software. This /// Sample Portal application does not save this value, and it is included here /// as sample code because these command line parameters may be of use. CommandLineSwitches = Request.Form["HD_Template_CommandLineSwitches" + templateIndex], /// ItemType can be an HD11+ template, a file, or a URL. HotDocs 11 (and later) /// sets this field, and HotDocs 10 does not set this field. The current /// Asp.Net web app could distinguish between HotDocs 11 templates and HotDocs 10 /// templates by examining this field to be non-empty for HotDocs 11 and empty /// for HotDocs 10. This Sample Portal application does not save this value, /// and it is included here as sample code. ItemType = Request.Form["HD_Template_UploadItemType" + templateIndex], /// ExpirationDate is an optional field that gives publishers the option of specifying /// a date when the current template will expire. This Sample Portal application /// does not save this value, and it is included here as sample code. ExpirationDate = Request.Form["HD_Template_Expiration_Date" + templateIndex], /// ExpirationWarningDays is an optional field used in conjunction with ExpirationDate /// that allows the user to be warned that the current template will expire the given /// number of days before the expireation date. This Sample Portal application /// does not save this value, and it is included here as sample code. ExpirationWarningDays = Request.Form["HD_Template_Warning_Days" + templateIndex], /// ExpirationExtensionDays is an optional field used in conjunction with ExpirationDate /// that allows the user to continue using the current template after the given /// expiration date has passed. This Sample Portal application does not save this /// value, and it is included here as sample code. ExpirationExtensionDays = Request.Form["HD_Template_Extension_Days" + templateIndex], PackageID = packageID, FullFilePath = packagePath }; using (SamplePortal.Data.Templates templates = new SamplePortal.Data.Templates()) { if (templates.TemplateExists(infoItem.MainTemplateFileName, infoItem.Title)) ConflictUploadItems.Add(infoItem); else { templates.InsertNewTemplate(infoItem); SuccessfulUploadItems.Add(infoItem); } } } templateIndex++; } else { string filename = Path.Combine(Settings.TemplatePath, finfo.Name); FileStream fs = File.OpenWrite(filename); postedFile.InputStream.CopyTo(fs); fs.Close(); } fileIndex++; } else { panelHDError.Visible = true; break; } } UpdatePanelVisibility(); } }
protected void DataListZCDC_ItemCommand(object source, DataListCommandEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem) { if (e.CommandName == "btEdit") { this.DataListZCDC.EditItemIndex = e.Item.ItemIndex; } if (e.CommandName == "btUpdate") { try { TextBox tb1 = (TextBox)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("tb1ZCDC")); TextBox tb2 = (TextBox)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("tb2ZCDC")); TextBox tb3 = (TextBox)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("tb3ZCDC")); DropDownList ddlLetBall = (DropDownList)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlLetBall")); DropDownList ddlLeagueType = (DropDownList)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("ddlLeagueType")); HiddenField hf1 = (HiddenField)(DataListZCDC.Items[e.Item.ItemIndex].FindControl("hfId")); if ((tb1.Text.Trim() == "") || (tb2.Text.Trim() == "") || (tb3.Text.Trim() == "")) { Shove._Web.JavaScript.Alert(this.Page, "本场比赛球队名称输入不完整!"); return; } object dt = PF.ValidLotteryTime(tb3.Text.Trim()); if (dt == null) { Shove._Web.JavaScript.Alert(this.Page, "本场比赛球队时间输入不正确!(格式:0000-00-00 00:00:00)"); return; } int id = int.Parse(hf1.Value); long IsuseID = int.Parse(tbIsuseID.Text); //int return_int = 0; //string return_str = ""; //DAL.Procedures.P_IsuseEditOneForZCDC(id, int.Parse(ddlLeagueType.SelectedValue), tb1.Text.Trim(), tb2.Text.Trim(), tb3.Text.Trim(), IsuseID, ddlLeagueType.SelectedValue, ref return_int, ref return_str); //if (return_int < 0) //{ // Shove._Web.JavaScript.Alert(this.Page, return_str); // return; //} //Shove._Web.JavaScript.Alert(this.Page, "更新成功!"); } catch { PF.GoError(ErrorNumber.Unknow, "单场信息更新错误。", this.Page.GetType().BaseType.FullName); return; } this.DataListZCDC.EditItemIndex = -1; } BindData(); } }
/// <summary> /// Clears all selected items from hidden values. /// </summary> /// <param name="field">Hidden field</param> private static void ClearHiddenValues(HiddenField field) { if (field != null) { field.Value = String.Empty; } }
/// <summary> /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control" /> object that child controls and templates belong to. These child controls are in turn defined within an inline template. /// </summary> /// <param name="container">The <see cref="T:System.Web.UI.Control" /> object to contain the instances of controls from the inline template.</param> public void InstantiateIn(Control container) { HtmlGenericContainer conditionalScaleRangeRuleContainer = new HtmlGenericContainer { ID = $"conditionalScaleRangeRuleContainer", CssClass = "row form-row" }; var hfRangeGuid = new HiddenField { ID = "hfRangeGuid" }; conditionalScaleRangeRuleContainer.Controls.Add(hfRangeGuid); Panel pnlColumn1 = new Panel { ID = "pnlColumn1", CssClass = "col-md-5" }; var labelTextBox = new RockTextBox { ID = "labelTextBox", Placeholder = "Label", CssClass = "margin-b-md", Required = true }; pnlColumn1.Controls.Add(labelTextBox); labelTextBox.Init += (object sender, EventArgs e) => { var parentValidationGroup = (labelTextBox.FindFirstParentWhere(a => a is IHasValidationGroup) as IHasValidationGroup)?.ValidationGroup; labelTextBox.ValidationGroup = parentValidationGroup; }; var highValueNumberBox = new NumberBox { ID = "highValueNumberBox", Placeholder = "High Value", CssClass = "margin-b-md" }; pnlColumn1.Controls.Add(highValueNumberBox); conditionalScaleRangeRuleContainer.Controls.Add(pnlColumn1); Panel pnlColumn2 = new Panel { ID = "pnlColumn2", CssClass = "col-md-5" }; var colorPicker = new ColorPicker { ID = "colorPicker", CssClass = "margin-b-md" }; pnlColumn2.Controls.Add(colorPicker); var lowValueNumberBox = new NumberBox { ID = "lowValueNumberBox", Placeholder = "Low Value", NumberType = ValidationDataType.Double }; pnlColumn2.Controls.Add(lowValueNumberBox); conditionalScaleRangeRuleContainer.Controls.Add(pnlColumn2); Panel pnlColumn3 = new Panel { ID = "pnlColumn3", CssClass = "col-md-2" }; LinkButton btnDeleteRule = new LinkButton { ID = "btnDeleteRule", CssClass = "btn btn-danger btn-sm", CausesValidation = false, Text = "<i class='fa fa-times'></i>" }; btnDeleteRule.Click += BtnDeleteRule_Click; pnlColumn3.Controls.Add(btnDeleteRule); conditionalScaleRangeRuleContainer.Controls.Add(pnlColumn3); container.Controls.Add(conditionalScaleRangeRuleContainer); container.Controls.Add(new HtmlGenericControl("hr")); }
/// <summary> /// Validates values in hidden fields with corresponding hash. /// </summary> /// <param name="field">Hidden field with values separated with |</param> /// <param name="hashField">Hidden field containing hash of <paramref name="field"/></param> private static bool ValidateHiddenValues(HiddenField field, HiddenField hashField) { return ValidationHelper.ValidateHash(field.Value, hashField.Value, redirect: false); }
protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { Administrator admin = (Administrator)e.Item.DataItem; CheckBox chkAcDec = (CheckBox)e.Item.FindControl("chkAcDec"); HiddenField hdfId = (HiddenField)e.Item.FindControl("hdfId"); hdfId.Value = admin.Id.ToString(); string userType = string.Empty; if (admin.IsActive) { chkAcDec.Checked = true; } else { chkAcDec.Checked = false; } LinkButton lnkBtnDelete = (LinkButton)e.Item.FindControl("lnkBtnDelete"); lnkBtnDelete.Attributes.Add("onclick", "return DeleteConfirmation('" + admin.LoginId + "');"); //try { // bool isAny = EntryList.GetEntryList(Guid.Empty, Guid.Empty, "").Where(x => x.AdminidAssignedto == admin.Id).Any(); // if (isAny) // { // lnkBtnDelete.Attributes.Clear(); // lnkBtnDelete.Attributes.Add("onclick", "return alert(\"This account already tagged to entry(s), can not be removed.\");"); // lnkBtnDelete.CommandName = ""; // } //} //catch { } if (Security.IsRoleSuperAdmin()) { lnkBtnDelete.Visible = true; } } if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; //item["Access"].Text = GeneralFunction.GetAdminType(item["Access"].Text); //TODO } else if (e.Item.ItemType == GridItemType.Pager) { //RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); //PageSizeCombo.Items.Clear(); //PageSizeCombo.Items.Add(new RadComboBoxItem("20", "20")); //PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID); //PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50")); //PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID); //PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100")); //PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID); //PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200")); //PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID); //PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999")); //PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", rgAdminUser.MasterTableView.ClientID); //string PageSize = e.Item.OwnerTableView.PageSize.ToString(); //PageSizeCombo.FindItemByValue(PageSize).Selected = true; } }
/// <summary> /// Clears all selected items from hidden values. /// </summary> /// <param name="field">Hidden field</param> private static void ClearHiddenValues(HiddenField field) { if (field != null) { field.Value = ""; } }
//handle row data bound protected void gvImportjob_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //int productid = Convert.ToInt32(gvImportjob.DataKeys[e.Row.RowIndex].Value); Label LblAction = new Label(); LblAction = (Label)e.Row.FindControl("lblAction"); HiddenField hidsku = new HiddenField(); hidsku = (HiddenField)e.Row.FindControl("hidsku"); Label lblstatus = new Label(); lblstatus = (Label)e.Row.FindControl("lblstatus"); HiddenField hiderrno = new HiddenField(); hiderrno = (HiddenField)e.Row.FindControl("hiderrno"); //hidsku productManager objproduct = new productManager(); objproduct.sku = hidsku.Value; int cont = objproduct.GetProdutctidCount(); if (cont > 0) { LblAction.Text = "Update"; } else { LblAction.Text = "Insert"; } Label lblErrorType = new Label(); lblErrorType = (Label)e.Row.FindControl("lblErrorType"); CheckBox chkDelete = (e.Row.FindControl("chkDelete") as CheckBox); //if (lblErrorType.Text == "1") if (lblErrorType.Text != "0") { lblstatus.Text = hiderrno.Value; chkDelete.Enabled = false; chkDelete.Visible = false; } else { lblstatus.Text = "Not Started"; } HiddenField hiddescp = new HiddenField(); hiddescp = (HiddenField)e.Row.FindControl("hiddescp"); Label lblDescription = new Label(); lblDescription = (Label)e.Row.FindControl("lblDescription"); if (hiderrno.Value != "0") { lblDescription.Text = hiddescp.Value; lblDescription.Style.Add("color", "red"); } else { lblDescription.Text = "Passed Validation"; lblDescription.Style.Add("color", "green"); } HiddenField hidstatus = new HiddenField(); hidstatus = (HiddenField)e.Row.FindControl("hidstatus"); if (hidstatus.Value == "1") { lblstatus.Text = "Completed"; } //if (hiderrno.Value == "0") //{ // //lblDescription.Text = "Check Validation"; // lblDescription.Text = hiddescp.Value; //} //else if (hiderrno.Value == "1") //{ // lblDescription.Text = hiddescp.Value; // lblDescription.Style.Add("color", "red"); //} //else //{ // lblDescription.Text = "Pass Validation"; // lblDescription.Style.Add("color", "green"); //} } if (e.Row.RowType == DataControlRowType.Header) { //Call the GetSortColumnIndex helper method to determine the index of the column being sorted. int sortColumnIndex = GetSortColumnIndex(); if (sortColumnIndex != -1) { //Call the AddSortImage helper method to add a sort direction image to the appropriate column header. AddSortImage(sortColumnIndex, e.Row); } } }
/// <summary> /// Sets array list values into hidden field. /// </summary> /// <param name="values">Arraylist of values to selection</param> /// <param name="field">Hidden field</param> private static void SetHiddenValues(ArrayList values, HiddenField actionsField, HiddenField hashField) { if (values != null) { if (actionsField != null) { // Build the list of actions StringBuilder sb = new StringBuilder(); sb.Append("|"); foreach (object value in values) { sb.Append(value); sb.Append("|"); } // Action IDs string actions = sb.ToString(); actionsField.Value = actions; // Actions hash if (hashField != null) { hashField.Value = ValidationHelper.GetHashString(actions); } } } }
private void CreatePageControl() { // Create dynamic controls here. btnNextPage = new Button(); btnNextPage.ID = "btnNextPage"; btnNextPage.Height = 1; btnNextPage.Width = 1; Form1.Controls.Add(btnNextPage); btnNextPage.Click += new System.EventHandler(btnNextPage_Click); btnPreviousPage = new Button(); btnPreviousPage.ID = "btnPreviousPage"; Form1.Controls.Add(btnPreviousPage); btnPreviousPage.Click += new System.EventHandler(btnPreviousPage_Click); btnGoPage = new Button(); btnGoPage.ID = "btnGoPage"; Form1.Controls.Add(btnGoPage); btnGoPage.Click += new System.EventHandler(btnGoPage_Click); HFD_CurrentPage = new HiddenField(); HFD_CurrentPage.Value = "1"; HFD_CurrentPage.ID = "HFD_CurrentPage"; Form1.Controls.Add(HFD_CurrentPage); HFD_CurrentSortField = new HiddenField(); HFD_CurrentSortField.Value = ""; HFD_CurrentSortField.ID = "HFD_CurrentSortField"; Form1.Controls.Add(HFD_CurrentSortField); HFD_CurrentSortDir = new HiddenField(); HFD_CurrentSortDir.Value = "asc"; HFD_CurrentSortDir.ID = "HFD_CurrentSortDir"; Form1.Controls.Add(HFD_CurrentSortDir); }
protected override void OnInit(EventArgs e) { base.OnInit(e); selectCurrency.Changed += (sender, args) => btnUpdate_Click1(null, null); // Add product button btnAddProduct = new CMSButton(); btnAddProduct.Attributes["style"] = "display: none"; Controls.Add(btnAddProduct); btnAddProduct.Click += btnAddProduct_Click; // Add the hidden fields for productId, quantity and product options hidProductID = new HiddenField { ID = "hidProductID" }; Controls.Add(hidProductID); hidQuantity = new HiddenField { ID = "hidQuantity" }; Controls.Add(hidQuantity); hidOptions = new HiddenField { ID = "hidOptions" }; Controls.Add(hidOptions); }
private void UpdateMaintenanceStockDataSource() { if (this.ViewState["Stock"] is DataTable) { DataTable dataTable = this.ViewState["Stock"] as DataTable; for (int i = 0; i < dataTable.Rows.Count; i++) { GridViewRow gridViewRow = this.gvMaintenanceStock.Rows[i]; DataRow dataRow = dataTable.Rows[i]; if (gridViewRow.FindControl("txtNumber") is TextBox) { TextBox textBox = gridViewRow.FindControl("txtNumber") as TextBox; if (!string.IsNullOrEmpty(textBox.Text.Trim())) { dataRow["Quantity"] = System.Convert.ToDecimal(textBox.Text.Trim()); } else { dataRow["Quantity"] = 0m; } } if (gridViewRow.FindControl("txtSprice") is TextBox) { TextBox textBox2 = gridViewRow.FindControl("txtSprice") as TextBox; if (!string.IsNullOrEmpty(textBox2.Text.Trim())) { dataRow["Price"] = textBox2.Text.Trim(); } else { dataRow["Price"] = 0m; } } dataRow["Total"] = System.Convert.ToDecimal(dataRow["Quantity"]) * System.Convert.ToDecimal(dataRow["Price"]); if (gridViewRow.FindControl("hfldCorp") is HiddenField) { HiddenField hiddenField = gridViewRow.FindControl("hfldCorp") as HiddenField; dataRow["CorpId"] = hiddenField.Value; } if (gridViewRow.FindControl("txtCorp") is TextBox) { TextBox textBox3 = gridViewRow.FindControl("txtCorp") as TextBox; dataRow["CorpName"] = textBox3.Text.Trim(); } if (gridViewRow.FindControl("hfldReceivePerson") is HiddenField) { HiddenField hiddenField2 = gridViewRow.FindControl("hfldReceivePerson") as HiddenField; dataRow["ReceivePerson"] = hiddenField2.Value; } if (gridViewRow.FindControl("txtReceiveDate") is TextBox) { TextBox textBox4 = gridViewRow.FindControl("txtReceiveDate") as TextBox; if (!string.IsNullOrEmpty(textBox4.Text.Trim())) { dataRow["ReceiveDate"] = System.Convert.ToDateTime(textBox4.Text.Trim()); } else { dataRow["ReceiveDate"] = System.DBNull.Value; } } } this.ViewState["Stock"] = dataTable; } }
protected void btnAdd_OnClick(object sender, EventArgs e) { this.AlertNone(lblMsg); ProductProvider productProvider = new ProductProvider(); AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct"); string measurementUnit = productProvider.GetMeasurementUnit(ddlProductValidation.SelectedValue.Toint()); if (ddlProductValidation.SelectedValue == "") { MessageHelper.ShowAlertMessage("Select Product!"); lblMsg.Focus(); return; } List <RequisitionDetailProvider> purchaseLedgerDetailsProviderList = new List <RequisitionDetailProvider>(); foreach (GridViewRow row in gvRequisition.Rows) { RequisitionDetailProvider obj = new RequisitionDetailProvider(); HiddenField hfRowProductID = (HiddenField)row.FindControl("hfProductID"); Label lblProductName = (Label)row.FindControl("lblProduct"); TextBox txtRequirement = (TextBox)row.FindControl("txtRequirement"); TextBox txtUnit = (TextBox)row.FindControl("txtUnit"); TextBox txtMonthlyConsume = (TextBox)row.FindControl("txtMonthlyConsume"); TextBox txtPresentStock = (TextBox)row.FindControl("txtPresentStock"); TextBox txtRemarks = (TextBox)row.FindControl("txtRemarks"); Label lblTotalAmount = (Label)row.FindControl("lblTotalAmount"); ImageButton btnAddOrDelete = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE"); if (hfRowProductID.Value == ddlProductValidation.SelectedValue) { MessageHelper.ShowAlertMessage("This product already exists!"); return; } if (txtRequirement.Text.ToDecimal() <= 0) { MessageHelper.ShowAlertMessage("Enter Quantity!"); return; } obj.ProductID = hfRowProductID.Value.Toint(); obj.ProductName = lblProductName.Text.ToString(); obj.RequiredQuantity = txtRequirement.Text.ToDecimal(); obj.MeasurementUnitName = txtUnit.Text.ToString(); obj.MonthlyConsumeQty = txtMonthlyConsume.Text.ToDecimal(); obj.PresentStock = txtPresentStock.Text.ToDecimal(); obj.Remarks = txtRemarks.Text.ToString(); purchaseLedgerDetailsProviderList.Add(obj); } AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct"); string productName = ddlProduct.SelectedItem.Text; int productID = ddlProduct.SelectedValue.Toint(); RequisitionDetailProvider obj2 = new RequisitionDetailProvider(); obj2.ProductID = productID; obj2.ProductName = productName; obj2.MeasurementUnitName = measurementUnit; obj2.PresentStock = productProvider.GetPresentStock(obj2.ProductID); purchaseLedgerDetailsProviderList.Add(obj2); if (!divGridForLSE.Visible) { divGridForLSE.Visible = true; } gvRequisition.DataSource = purchaseLedgerDetailsProviderList; gvRequisition.DataBind(); ddlRequisitionDivision.Enabled = false; RadioButtonList rbProductType = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType"); rbProductType.Enabled = false; }
/// <summary> /// Child control creation. /// </summary> protected override void CreateChildControls() { // Add product button this.btnRemoveProduct = new CMSButton(); this.btnRemoveProduct.Attributes["style"] = "display: none"; this.Controls.Add(this.btnRemoveProduct); this.btnRemoveProduct.Click += new EventHandler(btnRemoveProduct_Click); // Add the hidden fields for productId this.hidProductID = new HiddenField(); this.hidProductID.ID = "hidProductID"; this.Controls.Add(this.hidProductID); base.CreateChildControls(); }
protected void grLeaveApprove_RowCommand(object sender, GridViewCommandEventArgs e) { GridView _gridView = (GridView)sender; int _selectedIndex = int.Parse(e.CommandArgument.ToString()); string _commandName = e.CommandName; _gridView.SelectedIndex = _selectedIndex; switch (_commandName) { case ("ViewClick"): //Open New Window StringBuilder sb = new StringBuilder(); string strURL = "LeaveApplicationRpt.aspx?params=" + grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim() + "," + grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[0].ToString().Trim() + ", A"; sb.Append("<script>"); sb.Append("window.open('" + strURL + "', '', '');"); sb.Append("</script>"); ScriptManager.RegisterStartupScript(this, this.GetType(), "ConfirmSubmit", sb.ToString(), false); ClientScript.RegisterStartupScript(this.GetType(), "ConfirmSubmit", sb.ToString()); this.TabContainer1.ActiveTabIndex = 2; break; case ("CancelClick"): //Email Notification //lblMsgCancel.Text = objMail.LeaveCancelAfterApproval(grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), // grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[0].ToString().Trim(), Session["EMPID"].ToString(), // Session["USERNAME"].ToString(), Session["DESIGNATION"].ToString(), Session["LOCATION"].ToString(), // Session["USERID"].ToString().Trim().ToUpper() == "ADMIN" ? "Y" : "N", Session["EMAILID"].ToString()); DataTable dtLeaveProfile = new DataTable(); dtLeaveProfile = objLeaveMgr.SelectEmpLeaveProfile(grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[2].ToString()); HiddenField hfLvEnjoyed = new HiddenField(); if (dtLeaveProfile.Rows.Count > 0) { foreach (DataRow row in dtLeaveProfile.Rows) { if (string.IsNullOrEmpty(row["LeaveEnjoyed"].ToString()) == false) { hfLvEnjoyed.Value = Convert.ToString(Convert.ToDecimal(row["LeaveEnjoyed"].ToString()) - Convert.ToDecimal(grLeaveApprove.SelectedRow.Cells[6].Text.Trim())); if (Convert.ToDecimal(hfLvEnjoyed.Value) < 0) { hfLvEnjoyed.Value = "0"; } } else { hfLvEnjoyed.Value = "0"; } } } else { hfLvEnjoyed.Value = "0"; } this.CalculateLeaveDates("AC", grLeaveApprove.SelectedRow.Cells[4].Text.Trim(), grLeaveApprove.SelectedRow.Cells[5].Text.Trim()); this.GetWeekend(grLeaveApprove.SelectedRow.Cells[1].Text.Trim(), grLeaveApprove.SelectedRow.Cells[4].Text.Trim(), grLeaveApprove.SelectedRow.Cells[5].Text.Trim(), "AC"); LeaveApp objLeave = new LeaveApp(grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[0].ToString(), grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[11].ToString().Trim(), "", grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[9].ToString(), "", "", "", "C", "R", Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString()), "Y", "N", grLeaveApprove.DataKeys[_gridView.SelectedIndex].Values[2].ToString(), grLeaveApprove.SelectedRow.Cells[4].Text.Trim(), grLeaveApprove.SelectedRow.Cells[5].Text.Trim(), hfLvEnjoyed.Value.ToString(), "", "", "", ""); if (!string.IsNullOrEmpty(hfLDatesForCancel.Value)) { objLeaveMgr.UpdateLeaveAppMstForCancel(objLeave, "Y", "C", hfLvEnjoyed.Value.ToString(), hfLDatesForCancel.Value.ToString()); this.OpenRecord(); this.FillDenyLeaveList(); this.FillApproveLeaveList(); this.TabContainer1.ActiveTabIndex = 2; lblMsgCancel.Text = "Leave has been Cancelled Successfully"; } //else //{ // lblMsgCancel.Text = "Leave has been Cancelled Successfully"; //} break; } }
/// <summary> /// Returns array list from hidden field. /// </summary> /// <param name="field">Hidden field with values separated with |</param> /// <param name="hashField">Hidden field containing hash of <paramref name="field"/></param> private static List<string> GetHiddenValues(HiddenField field, HiddenField hashField) { var result = new List<string>(); if (ValidateHiddenValues(field, hashField)) { result.AddRange(field.Value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Distinct(StringComparer.InvariantCultureIgnoreCase).ToList()); } return result; }
protected void GetWeekend(string strEmpId, string strFromDate, string strToDate, string gridStatus) { HiddenField hfLeaveDates = new HiddenField(); HiddenField hfWeeekendDay = new HiddenField(); double TotDay = 0; DateTime dtFrom = new DateTime(); DateTime dtTo = new DateTime(); if (string.IsNullOrEmpty(strFromDate) == true) { lblMsg.Text = "Please insert valid start date"; return; } if (string.IsNullOrEmpty(strToDate) == true) { lblMsg.Text = "Please insert valid end date"; return; } if (string.IsNullOrEmpty(strToDate) == false && string.IsNullOrEmpty(strFromDate) == false) { char[] splitter = { '/' }; string[] arinfo = Common.str_split(strFromDate, splitter); if (arinfo.Length == 3) { dtFrom = Convert.ToDateTime(arinfo[2] + "/" + arinfo[1] + "/" + arinfo[0]); arinfo = null; } arinfo = Common.str_split(strToDate, splitter); if (arinfo.Length == 3) { dtTo = Convert.ToDateTime(arinfo[2] + "/" + arinfo[1] + "/" + arinfo[0]); arinfo = null; } TimeSpan Dur = dtTo.Subtract(dtFrom); TotDay = Math.Round(Convert.ToDouble(Dur.Days), 0) + 1; if (TotDay < 0) { lblMsg.Text = "Start date can not be greater than end date."; return; } } DataTable dtEmpWeekend = new DataTable(); dtEmpWeekend = objLeaveMgr.SelectEmpWiseWeekend(strEmpId); DateTime LDate = dtFrom; int row; int LeaveDay = 0; TotWeekedDay = 0; hfLeaveDates.Value = ""; if (dtEmpWeekend.Rows.Count > 0) { for (row = 0; row < Convert.ToInt32(TotDay); row++) { string DayName = LDate.DayOfWeek.ToString(); switch (DayName) { case "Sunday": { if (dtEmpWeekend.Rows[0]["WESun"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Sunday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Sunday"; } TotWeekedDay++; continue; } } case "Monday": { if (dtEmpWeekend.Rows[0]["WEMon"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Monday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Monday"; } TotWeekedDay++; continue; } } case "Tuesday": { if (dtEmpWeekend.Rows[0]["WETues"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Tuesday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Tuesday"; } TotWeekedDay++; continue; } } case "Wednesday": { if (dtEmpWeekend.Rows[0]["WEWed"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Wednesday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Wednesday"; } TotWeekedDay++; continue; } } case "Thursday": { if (dtEmpWeekend.Rows[0]["WETue"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Thursday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Thursday"; } TotWeekedDay++; continue; } } case "Friday": { if (dtEmpWeekend.Rows[0]["WEFri"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Friday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Friday"; } TotWeekedDay++; continue; } } case "Saturday": { if (dtEmpWeekend.Rows[0]["WESat"].ToString() == "N") { LeaveDay = LeaveDay + 1; if (hfLeaveDates.Value != "") { hfLeaveDates.Value = hfLeaveDates.Value + "," + Common.SetDate(LDate.ToString()); } else { hfLeaveDates.Value = Common.SetDate(LDate.ToString()); } break; } else { LDate = LDate.AddDays(1); if (hfWeeekendDay.Value == "") { hfWeeekendDay.Value = "Saturday"; } else { hfWeeekendDay.Value = hfWeeekendDay.Value + ", Saturday"; } TotWeekedDay++; continue; } } } LDate = LDate.AddDays(1); } } if ((gridStatus == "A") || (gridStatus == "D")) { hfLDates.Value = hfLeaveDates.Value; } else { hfLDatesForCancel.Value = hfLeaveDates.Value; } }
protected void btnSave_Click(object sender, EventArgs e) { string modetypename = this.txtmodetypename.Text; int typeId = int.Parse(this.txttypeId.Text); int isOpen = 0; int.TryParse(ddlOpen.SelectedValue, out isOpen); int supplier = 0; int.TryParse(this.ddlSupplier.SelectedValue, out supplier); int supplier2 = 0; if (!string.IsNullOrEmpty(this.ddlSupplier2.SelectedValue)) { int.TryParse(this.ddlSupplier2.SelectedValue, out supplier2); } int sort = int.Parse(this.txtsort.Text); bool release = this.rblRelease.SelectedValue == "1" ? true :false; int classId = Convert.ToInt32(this.rblType.SelectedValue); if (!IsUpdate) { ItemInfo.modetypename = modetypename; ItemInfo.typeId = typeId; ItemInfo.Class = (ChannelClassEnum)classId; ItemInfo.addtime = DateTime.Now; } ItemInfo.isOpen = (OpenEnum)isOpen; ItemInfo.supplier = supplier; ItemInfo.supplier2 = supplier2; ItemInfo.SuppsWhenExceOccurred = txtSuppsWhenExceOccurred.Text.Trim(); ItemInfo.sort = sort; ItemInfo.release = release; ItemInfo.runmode = int.Parse(this.rblrunmode.SelectedValue); ItemInfo.timeout = int.Parse(this.txttimeout.Text); System.Text.StringBuilder _set = new System.Text.StringBuilder(); int count = 1; foreach (RepeaterItem item in rptsupp.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { HtmlInputCheckBox chkItem = item.FindControl("chkItem") as HtmlInputCheckBox; HiddenField hfsuppid = item.FindControl("hfsuppid") as HiddenField; TextBox txtweight = item.FindControl("txtweight") as TextBox; if (chkItem != null && hfsuppid != null && txtweight != null) { if (chkItem.Checked) { int weight = 1; try { weight = Convert.ToInt32(txtweight.Text); } catch { weight = 1; } if (count > 1) { _set.AppendFormat("|{0}:{1}", hfsuppid.Value, weight); } else { _set.AppendFormat("{0}:{1}", hfsuppid.Value, weight); } count++; } } } } ItemInfo.runset = _set.ToString(); if (!this.IsUpdate) { int id = ChannelType.Add(ItemInfo); if (id > 0) { AlertAndRedirect("保存成功!", "TypeList.aspx"); } else { ShowMessageBox("保存失败!"); } } else { if (ChannelType.Update(ItemInfo)) { viviapi.WebComponents.WebUtility.ClearCache("CHANNELTYPE_CACHEKEY"); AlertAndRedirect("更新成功!", "TypeList.aspx"); } else { ShowMessageBox("更新失败!"); } } }
/// <summary> /// Returns array list from hidden field. /// </summary> /// <param name="field">Hidden field with values separated with |</param> private static ArrayList GetHiddenValues(HiddenField field) { string hiddenValue = field.Value.Trim('|'); ArrayList list = new ArrayList(); string[] values = hiddenValue.Split('|'); foreach (string value in values) { if (!list.Contains(value)) { list.Add(value); } } list.Remove(""); return list; }
private void Dispose(bool disposing) { if (!disposing) { return; } if (this.dateTextBox != null) { this.dateTextBox.Dispose(); this.dateTextBox = null; } if (this.itemCodeHidden != null) { this.itemCodeHidden.Dispose(); this.itemCodeHidden = null; } if (this.itemIdHidden != null) { this.itemIdHidden.Dispose(); this.itemIdHidden = null; } if (this.modeHidden != null) { this.modeHidden.Dispose(); this.modeHidden = null; } if (this.partyCodeHidden != null) { this.partyCodeHidden.Dispose(); this.partyCodeHidden = null; } if (this.partyCodeInputText != null) { this.partyCodeInputText.Dispose(); this.partyCodeInputText = null; } if (this.partyIdHidden != null) { this.partyIdHidden.Dispose(); this.partyIdHidden = null; } if (this.priceTypeIdHidden != null) { this.priceTypeIdHidden.Dispose(); this.priceTypeIdHidden = null; } if (this.productGridViewDataHidden != null) { this.productGridViewDataHidden.Dispose(); this.productGridViewDataHidden = null; } if (this.referenceNumberInputText != null) { this.referenceNumberInputText.Dispose(); this.referenceNumberInputText = null; } if (this.statementReferenceTextArea != null) { this.statementReferenceTextArea.Dispose(); this.statementReferenceTextArea = null; } if (this.salesPersonIdHidden != null) { this.salesPersonIdHidden.Dispose(); this.salesPersonIdHidden = null; } if (this.shipperIdHidden != null) { this.shipperIdHidden.Dispose(); this.shipperIdHidden = null; } if (this.shippingAddressCodeHidden != null) { this.shippingAddressCodeHidden.Dispose(); this.shippingAddressCodeHidden = null; } if (this.storeIdHidden != null) { this.storeIdHidden.Dispose(); this.storeIdHidden = null; } if (this.title != null) { this.title.Dispose(); this.title = null; } if (this.tranIdCollectionHidden != null) { this.tranIdCollectionHidden.Dispose(); this.tranIdCollectionHidden = null; } if (this.unitIdHidden != null) { this.unitIdHidden.Dispose(); this.unitIdHidden = null; } if (this.unitNameHidden != null) { this.unitNameHidden.Dispose(); this.unitNameHidden = null; } if (this.placeHolder != null) { this.placeHolder.Dispose(); this.placeHolder = null; } this.disposed = true; }
public void readPage(SqlConnection con) { string value = Context.Request["it"]; if (value == null) return; ((HiddenField)Master.FindControl("PageIndex")).Value = value; SqlCommand cmd = new SqlCommand("SELECT * FROM [Url] WHERE [it] = @it ORDER BY [index]", con); cmd.Parameters.AddWithValue("@it", value); SqlDataReader reader = cmd.ExecuteReader(); for (int i = 1; reader.Read(); i++) { HiddenField hid = new HiddenField(); hid.ID = "page" + i.ToString(); hid.Value = reader["url"].ToString(); Url.Controls.Add(hid); } reader.Close(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (IsValid) { /*********************************************************/ string str2ndManager = hdfSecondManager.Value; /************* Creaete Object Appraisal Doc Line *********/ AppraisalDocHeader dataHeader = new AppraisalDocHeader(); dataHeader.AppraisalDate = DateTime.Now; dataHeader.EmployeeID = hdfEmployeeID.Value.Trim(); // DateTime.ParseExact(this.Text, "dd/MM/yyyy", null); if (!string.IsNullOrEmpty(lblDateFrom.Text.Trim())) { dataHeader.AppraisalPeriodFrom = DateTime.ParseExact(lblDateFrom.Text.Trim(), "dd/MM/yyyy", null); } if (!string.IsNullOrEmpty(lblDateTo.Text.Trim())) { dataHeader.AppraisalPeriodTo = DateTime.ParseExact(lblDateTo.Text.Trim(), "dd/MM/yyyy", null); } //**** Check case no 2nd Manager ****// dataHeader.AppraisalStatus = string.IsNullOrEmpty(str2ndManager) ? "Completed" : "Waiting 2nd Manager Approve"; dataHeader.AppraisalYear = DateTime.Now.Year; dataHeader.CompanyID = hdfCompanyID.Value.Trim(); dataHeader.CreatedBy = hdfUserLogin.Value.Trim(); dataHeader.CreatedDate = DateTime.Now; dataHeader.DepartmentName = lblDepartment.Text; dataHeader.EmployeeImprovement = txtEmpImpovement.Text; dataHeader.EmployeeName = lblEmployeeName.Text; dataHeader.EmployeeStrength = txtEmpStrength.Text; dataHeader.Position = lblPosition.Text; if (!string.IsNullOrEmpty(lblJoinDate.Text)) { dataHeader.StartDate = DateTime.ParseExact(lblJoinDate.Text.Trim(), "dd/MM/yyyy", null); } /*********************************************************/ /************* Creaete Object Appraisal Doc Line *********/ /*********************************************************/ List <AppraisalDocLine> lAppraisalDocLine = new List <AppraisalDocLine>(); /****************** Gridview Part 1 **********************/ int iAppraisalDocLineNo = 1; foreach (GridViewRow row in gvAppraisalPart1.Rows) { Label lblPart1Score = row.FindControl("lblPart1Score") as Label; string sScore = lblPart1Score.Text.Trim(); DropDownList ddlPart1Result = row.FindControl("ddlPart1Result") as DropDownList; string sAgreeReqult = ddlPart1Result.SelectedValue; TextBox txtPart1Comment = row.FindControl("txtPart1Comment") as TextBox; txtPart1Comment.MaxLength = 150; string sComment = txtPart1Comment.Text; HiddenField hdfPart1QuestionDesc = row.FindControl("hdfPart1QuestionDesc") as HiddenField; HiddenField hdfPart1QuestionLineNo = row.FindControl("hdfPart1QuestionLineNo") as HiddenField; HiddenField hdfPart1QuestionType = row.FindControl("hdfPart1QuestionType") as HiddenField; HiddenField hdfPart1QuestionWeight = row.FindControl("hdfPart1QuestionWeight") as HiddenField; AppraisalDocLine itemPart1 = new AppraisalDocLine(); itemPart1.AppraisalDocLineNo = iAppraisalDocLineNo; itemPart1.Score = string.IsNullOrEmpty(sAgreeReqult) ? 0 : Convert.ToInt16(sAgreeReqult); itemPart1.QuestionLineNo = Convert.ToInt16(hdfPart1QuestionLineNo.Value); itemPart1.QuestionDesc = hdfPart1QuestionDesc.Value; itemPart1.QuestionType = Convert.ToInt16(hdfPart1QuestionType.Value); itemPart1.CalculatedScore = string.IsNullOrEmpty(sScore) ? 0 : Convert.ToDecimal(sScore); itemPart1.QuestionWeight = string.IsNullOrEmpty(hdfPart1QuestionWeight.Value) ? 0 : Convert.ToDecimal(hdfPart1QuestionWeight.Value); itemPart1.Remark = sComment; lAppraisalDocLine.Add(itemPart1); iAppraisalDocLineNo += 1; } /*********************************************************/ /***************** Gridview Part 2 ***********************/ foreach (GridViewRow row in gvAppraisalPart2.Rows) { Label lblPart1Score = row.FindControl("lblPart2Score") as Label; string sScore = lblPart1Score.Text.Trim(); DropDownList ddlPart2Result = row.FindControl("ddlPart2Result") as DropDownList; string sAgreeReqult = ddlPart2Result.SelectedValue; TextBox txtPart2Comment = row.FindControl("txtPart2Comment") as TextBox; txtPart2Comment.MaxLength = 150; string sComment = txtPart2Comment.Text; HiddenField hdfPart2QuestionDesc = row.FindControl("hdfPart2QuestionDesc") as HiddenField; HiddenField hdfPart2QuestionLineNo = row.FindControl("hdfPart2QuestionLineNo") as HiddenField; HiddenField hdfPart2QuestionType = row.FindControl("hdfPart2QuestionType") as HiddenField; HiddenField hdfPart2QuestionWeight = row.FindControl("hdfPart2QuestionWeight") as HiddenField; AppraisalDocLine itemPart2 = new AppraisalDocLine(); itemPart2.AppraisalDocLineNo = iAppraisalDocLineNo; itemPart2.Score = string.IsNullOrEmpty(sAgreeReqult) ? 0 : Convert.ToInt16(sAgreeReqult); itemPart2.QuestionLineNo = Convert.ToInt16(hdfPart2QuestionLineNo.Value); itemPart2.QuestionDesc = hdfPart2QuestionDesc.Value; itemPart2.QuestionType = Convert.ToInt16(hdfPart2QuestionType.Value); itemPart2.CalculatedScore = string.IsNullOrEmpty(sScore) ? 0 : Convert.ToDecimal(sScore); itemPart2.QuestionWeight = string.IsNullOrEmpty(hdfPart2QuestionWeight.Value) ? 0 : Convert.ToDecimal(hdfPart2QuestionWeight.Value); itemPart2.Remark = sComment; lAppraisalDocLine.Add(itemPart2); iAppraisalDocLineNo += 1; } /*********************************************************/ /***************** Set Grade & Score ********************/ int TotalScore = 0; string gradeResult = ""; gradeResult = CalculateGrade(lAppraisalDocLine, ref TotalScore); dataHeader.AppraisalTotalScore = TotalScore; dataHeader.AppraisalGrade = gradeResult; //***************** List Attach File for insert to Database ********* List <Attachment> lAttachFile = new List <Attachment>(); DataTable dtUpload = (DataTable)Session["tbAttachFile"]; if (dtUpload != null && dtUpload.Rows.Count > 0) { for (int i = 0; i < dtUpload.Rows.Count; i++) { Attachment attachData = new Attachment(); attachData.FileName = dtUpload.Rows[i]["FileName"].ToString(); attachData.EmployeeID = dtUpload.Rows[i]["EmployeeID"].ToString(); attachData.FileDescription = dtUpload.Rows[i]["Description"].ToString(); attachData.Attachment1 = dtUpload.Rows[i]["AttachFilePath"].ToString(); attachData.CreatedDate = DateTime.Now; attachData.CreatedBy = hdfUserLogin.Value.Trim(); lAttachFile.Add(attachData); } } //********************************************************************** ActionHistory updActHisData = new ActionHistory(); updActHisData.EmployeeID = hdfEmployeeID.Value.Trim(); updActHisData.CreatedBy = hdfUserLogin.Value.Trim(); updActHisData.Status = "Approved"; updActHisData.Comments = txtRemark.Text; updActHisData.AppraisalYear = DateTime.Now.Year; ApprovalHistory insAppHis = new ApprovalHistory(); insAppHis.Action = "Approve"; insAppHis.Comment = txtRemark.Text; insAppHis.TransactionDate = DateTime.Now; insAppHis.UserID = hdfUserLogin.Value.Trim(); ActionHistory ins2NdActHisData = new ActionHistory(); if (!string.IsNullOrEmpty(hdfSecondManager.Value)) { ins2NdActHisData.EmployeeID = hdfEmployeeID.Value.Trim(); ins2NdActHisData.Action = "Approve"; ins2NdActHisData.AppraisalYear = DateTime.Now.Year; ins2NdActHisData.CreatedBy = hdfSecondManager.Value.Trim(); ins2NdActHisData.CreatedDate = DateTime.Now; ins2NdActHisData.Responsibility = "SecondManager"; } //--------------------------------------------------------------// /********************** Insert to DataBase ****************************/ AppraisalDocHeader_Manage manage = new AppraisalDocHeader_Manage(); bool insResult = manage.InsertDocHeaderData(dataHeader, lAttachFile, lAppraisalDocLine, updActHisData, insAppHis, ins2NdActHisData); if (insResult) { lblMsgResult.Text = "บันทึกข้อมูลเรียบร้อย"; lbtnPopup_ModalPopupExtender.Show(); string sSubjectMail = ConfigurationManager.GetConfiguration().SubjectMailApprove; string sEmailFrom = ConfigurationManager.GetConfiguration().EmailFrom; string reqDate = DateTime.Now.ToString(@"dd\/MM\/yyyy"); string Email2ndManager = hdfSecondManagerMail.Value.Trim(); if (!string.IsNullOrEmpty(Email2ndManager)) { string _employeeName = lblEmployeeName.Text; string emaiBody = GenEmailBody(hdfEmployeeID.Value.Trim(), hdfSecondManager.Value.Trim(), hdfUserLogin.Value.Trim(), reqDate, _employeeName); SendMail2ndManager(sSubjectMail, emaiBody, Email2ndManager, sEmailFrom); } } else { lblMsgResult.Text = "ไม่สามารถบันทึกข้อมูลได้"; btnOK.Visible = false; btnCancel.Visible = true; lbtnPopup_ModalPopupExtender.Show(); } /*********************************************************/ } } catch (Exception ex) { logger.Error(ex.Message); logger.Error(ex.StackTrace); //*** Show Popup When Error (Exception) ***** lblMsgResult.Text = "ไม่สามารถบันทึกข้อมูลได้ กรุณาติดต่อผู้ดูแลระบบ"; btnOK.Visible = false; btnCancel.Visible = true; lbtnPopup_ModalPopupExtender.Show(); //********************************* } }
protected void Page_Load(object sender, EventArgs e) { ((BXAdminMasterPage)Page.Master).Title = Page.Title; if (userId > 0) BXRoleManager.SynchronizeProviderUserRoles(user.UserName, user.ProviderName); var filter = new BXFormFilter( new BXFormFilterItem("Active", true, BXSqlFilterOperators.Equal) ); var roles = userId > 0 ? rolesToViewAndModify : rolesToCreate; if (roles.Length != 1 || roles[0] != 0) filter.Add(new BXFormFilterItem("Id", roles, BXSqlFilterOperators.In)); BXRoleCollection rolesTmp = BXRoleManager.GetList( filter, new BXOrderBy_old("RoleName", "Asc") ); foreach (int i in new[] { 1, 3, 2 }) { var r = rolesTmp.Find(x => x.RoleId == i); if (r != null) { rolesTmp.Remove(r); rolesTmp.Insert(0, r); } } foreach (BXRole roleTmp in rolesTmp) { HtmlTableRow r1 = new HtmlTableRow(); r1.VAlign = "top"; HtmlTableCell c1 = new HtmlTableCell(); CheckBox cb = new CheckBox(); cb.ID = String.Format("tbCheck_{0}", roleTmp.RoleId.ToString()); cb.Checked = false; c1.Controls.Add(cb); HiddenField hf = new HiddenField(); hf.ID = String.Format("tbCheck_{0}_old", roleTmp.RoleId.ToString()); hf.Value = "N"; c1.Controls.Add(hf); r1.Cells.Add(c1); c1 = new HtmlTableCell(); c1.InnerHtml = String.Format("<a href=\"AuthRolesEdit.aspx?name={0}\">{1}</a>", Server.UrlEncode(roleTmp.RoleName), Server.HtmlEncode(roleTmp.Title)); r1.Cells.Add(c1); c1 = new HtmlTableCell(); c1.Align = "center"; c1.Style["padding-right"] = "10px"; c1.Style["padding-left"] = "10px"; TextBox tb1 = new TextBox(); tb1.ID = String.Format("tbActiveFrom_{0}", roleTmp.RoleId.ToString()); c1.InnerHtml = "c "; c1.Controls.Add(tb1); hf = new HiddenField(); hf.ID = String.Format("tbActiveFrom_{0}_old", roleTmp.RoleId.ToString()); hf.Value = ""; c1.Controls.Add(hf); r1.Cells.Add(c1); c1 = new HtmlTableCell(); c1.Align = "center"; tb1 = new TextBox(); tb1.ID = String.Format("tbActiveTo_{0}", roleTmp.RoleId.ToString()); c1.InnerHtml = string.Format("{0} ", GetMessage("TabCellInnerHtml.To")); c1.Controls.Add(tb1); hf = new HiddenField(); hf.ID = String.Format("tbActiveTo_{0}_old", roleTmp.RoleId.ToString()); hf.Value = ""; c1.Controls.Add(hf); r1.Cells.Add(c1); tblRoles.Rows.Add(r1); } if (!Page.IsPostBack) LoadData(); if (userId > 0) { if (!missingProvider) { trPasswordQuestion.Style["display"] = (Membership.Providers[user.ProviderName].RequiresQuestionAndAnswer ? "" : "none"); trPasswordAnswer.Style["display"] = (Membership.Providers[user.ProviderName].RequiresQuestionAndAnswer ? "" : "none"); } else { trPasswordQuestion.Style["display"] = "none"; trPasswordAnswer.Style["display"] = "none"; trPassword.Style["display"] = "none"; trNewPassword.Style["display"] = "none"; trNewPasswordConf.Style["display"] = "none"; } } else { if (!String.IsNullOrEmpty(ddProviderName.SelectedValue)) { trPasswordQuestion.Style["display"] = (Membership.Providers[(ddProviderName.SelectedValue.Equals(GetMessageRaw("String.InnerProvider"), StringComparison.InvariantCultureIgnoreCase) ? "BXSqlMembershipProvider" : ddProviderName.SelectedValue)].RequiresQuestionAndAnswer ? "" : "none"); trPasswordAnswer.Style["display"] = (Membership.Providers[(ddProviderName.SelectedValue.Equals(GetMessageRaw("String.InnerProvider"), StringComparison.InvariantCultureIgnoreCase) ? "BXSqlMembershipProvider" : ddProviderName.SelectedValue)].RequiresQuestionAndAnswer ? "" : "none"); } else { trPasswordQuestion.Style["display"] = (Membership.Provider.RequiresQuestionAndAnswer ? "" : "none"); trPasswordAnswer.Style["display"] = (Membership.Provider.RequiresQuestionAndAnswer ? "" : "none"); } } DeleteUserSeparator.Visible = DeleteUserButton.Visible = userId > 0 && currentUserCanDeleteUser; AddUserSeparator.Visible = AddUserButton.Visible = userId > 0 && currentUserCanCreateUser; BXTabControl1.ShowSaveButton = BXTabControl1.ShowApplyButton = (userId <= 0 && currentUserCanCreateUser) || (userId > 0 && (currentUserCanModifyUser || currentUserCanModifySelfUser)); }
void grdManifest_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { DataRowView drv = (DataRowView)e.Item.DataItem; HiddenField hidOrderId = (HiddenField)e.Item.FindControl("hidOrderId"); Label lblCustomer = (Label)e.Item.FindControl("lblCustomer"); Label lblStartFrom = (Label)e.Item.FindControl("lblStartFrom"); Label lblStartAt = (Label)e.Item.FindControl("lblStartAt"); CheckBox chkOrderID = (CheckBox)e.Item.FindControl("chkOrderID"); HtmlAnchor hypOrderId = (HtmlAnchor)e.Item.FindControl("hypOrderId"); int orderId = int.Parse(drv["OrderId"].ToString()); hidOrderId.Value = orderId.ToString(); hypOrderId.HRef = "javascript:viewOrderProfile(" + orderId.ToString() + ");"; HtmlAnchor hypJobId = (HtmlAnchor)e.Item.FindControl("hypJobId"); int JobId = 0; int.TryParse(drv["JobId"].ToString(), out JobId); if (JobId > 0) { hypJobId.InnerText = JobId.ToString(); hypJobId.HRef = "javascript:ViewJobDetails(" + JobId.ToString() + ");"; } else { hypJobId.InnerText = string.Empty; hypJobId.HRef = string.Empty; } lblCustomer.Text = drv["Customer"].ToString(); lblStartFrom.Text = drv["StartFrom"].ToString(); lblStartAt.Text = drv["StartAtDisplay"].ToString(); chkOrderID.Attributes.Add("onclick", "javascript:ChangeList(event,this);"); if (drv["Removed"].ToString().ToLower() == "true") { hypOrderId.InnerText = orderId.ToString() + " (Removed)"; chkOrderID.Checked = false; e.Item.Enabled = false; e.Item.CssClass = "GridRow_Office2007"; } else { hypOrderId.InnerText = orderId.ToString(); if (string.IsNullOrEmpty(drv["JobId"].ToString())) { // Order is no longer on a job -- assume that it should be removed at the next save. chkOrderID.Checked = false; } else { chkOrderID.Checked = true; e.Item.CssClass = "SelectedRow_Office2007"; } } } else if (e.Item.ItemType == GridItemType.Header) { //HtmlInputCheckBox chkAll = (HtmlInputCheckBox)e.Item.FindControl("chkAll"); //chkAll.Checked = true; } }
protected void GridView_LineInfo_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { labRenShu = (Label)e.Row.FindControl("labRenShu"); Label3 = (Label)e.Row.FindControl("Label3"); Label5 = (Label)e.Row.FindControl("Label5"); Label6 = (Label)e.Row.FindControl("Label6"); string renshu = labRenShu.Text.Substring(0,labRenShu.Text.IndexOf("/")); renshunmu = Convert.ToDecimal(renshu.Split('+')[0]) + Convert.ToDecimal(renshu.Split('+')[1]); hf_Counter = (HiddenField)e.Row.FindControl("hf_Counter"); if (hf_Counter.Value.Equals("1")) { e.Row.ForeColor = System.Drawing.Color.Green; e.Row.BackColor = System.Drawing.Color.White; e.Row.Font.Bold = true; } if (renshunmu > 0) { // Label6.Text = (Convert.ToDecimal(Label5.Text) / renshunmu).ToString("0.00"); } else { // Label6.Text = "——"; } Label7 = (Label)e.Row.FindControl("Label7"); Label8 = (Label)e.Row.FindControl("Label8"); if (!Label3.Text.Equals("") && !Convert.ToDecimal(Label3.Text).Equals(0)) { // Label7.Text = (Convert.ToDecimal(Label5.Text) / Convert.ToDecimal(Label3.Text) * 100).ToString("0.00") + "%"; } else { Label7.Text = "——"; } if (Convert.ToDecimal(HFZongProfitTemp.Value) > 0) { // Label8.Text = (Convert.ToDecimal(Label5.Text) / Convert.ToDecimal(HFZongProfitTemp.Value) * 100).ToString("0.00") + "%"; } } if (e.Row.RowType == DataControlRowType.Footer) { labRenShuF = (Label)e.Row.FindControl("labRenShuF"); Label4F = (Label)e.Row.FindControl("Label4F"); Label3F = (Label)e.Row.FindControl("Label3F"); Label5F = (Label)e.Row.FindControl("Label5F"); Label6F = (Label)e.Row.FindControl("Label6F"); Label7F = (Label)e.Row.FindControl("Label7F"); Label8F = (Label)e.Row.FindControl("Label8F"); int adultnum = 0; int childnum = 0; decimal lb3 = 0; decimal lb4 = 0; decimal lb5 = 0; foreach (GridViewRow gr in GridView_LineInfo.Rows) { if (gr.RowType == DataControlRowType.DataRow) { hf_Counter = (HiddenField)gr.FindControl("hf_Counter"); if (!hf_Counter.Value.Equals("1")) { labRenShu = (Label)gr.FindControl("labRenShu"); adultnum += Convert.ToInt32(labRenShu.Text.Substring(0, labRenShu.Text.IndexOf("+"))); childnum += Convert.ToInt32(labRenShu.Text.Substring(labRenShu.Text.IndexOf("+")).Replace("/2", "")); lb4 += Convert.ToDecimal(((Label)gr.FindControl("Label4")).Text); lb3 += Convert.ToDecimal(((Label)gr.FindControl("Label3")).Text); lb5 += Convert.ToDecimal(((Label)gr.FindControl("Label5")).Text); } } } labRenShuF.Text = adultnum + "+" + childnum + "/2"; Label3F.Text = lb3.ToString("0.00"); Label4F.Text = lb4.ToString("0.00"); Label5F.Text = lb5.ToString("0.00"); if ((adultnum + decimal.Parse(childnum.ToString()) / 2) > 0) { Label6F.Text = (lb5 / (adultnum + decimal.Parse(childnum.ToString()) / 2)).ToString("0.00"); } if (lb3 > 0) { Label7F.Text = (lb5 / lb3 * 100).ToString("0.00") + "%"; } if (Convert.ToDecimal(HFZongProfitTemp.Value) > 0) { Label8F.Text = (lb5 / Convert.ToDecimal(HFZongProfitTemp.Value) * 100) + "%"; } } }
private void saveval() { StringBuilder strIDVals = new StringBuilder(); StringBuilder strItemdesciption = new StringBuilder(); StringBuilder stritemUnits = new StringBuilder(); StringBuilder strItemRequestQty = new StringBuilder(); StringBuilder strItemComments = new StringBuilder(); StringBuilder strUnitPrice = new StringBuilder(); StringBuilder strDiscount = new StringBuilder(); StringBuilder strSuppCode = new StringBuilder(); StringBuilder strBgtCode = new StringBuilder(); StringBuilder ItemRefCode = new StringBuilder(); int i = 0; DataTable dtExtraItems = new DataTable(); dtExtraItems.Columns.Add("pkid"); dtExtraItems.Columns.Add("Item_Code"); dtExtraItems.Columns.Add("Item_Short_Desc"); dtExtraItems.Columns.Add("ORDER_QTY"); dtExtraItems.Columns.Add("ORDER_PRICE"); dtExtraItems.Columns.Add("Item_Discount"); dtExtraItems.Columns.Add("Unit"); dtExtraItems.Columns.Add("Item_Long_Desc"); // dtExtraItems.Columns.Add("BGT_CODE"); int inc = 1; foreach (GridDataItem dataItem in rgdItems.MasterTableView.Items) { HiddenField lblgrdID = (dataItem.FindControl("lblID") as HiddenField); TextBox txtgrdItem_Code = (dataItem.FindControl("txtItem_Code") as TextBox); TextBox txtgrdItemReqQty = (dataItem.FindControl("txtRequest_Qty") as TextBox); TextBox txtgrdItemComent = (dataItem.FindControl("txtItem_Comments") as TextBox); TextBox txtItemDescription = (dataItem.FindControl("txtItem_Description") as TextBox); TextBox txtUnit = (dataItem.FindControl("cmbUnitnPackage") as TextBox); TextBox txtDiscount = (dataItem.FindControl("txtDiscount") as TextBox); TextBox txtUnitPrice = (dataItem.FindControl("txtUnitPrice") as TextBox); //string BgtCode = (dataItem.FindControl("ddlBudgetCode") as DropDownList).SelectedValue; if (txtgrdItemReqQty.Text.Length > 0 && txtItemDescription.Text.Length > 0) { DataRow dritem = dtExtraItems.NewRow(); dritem["pkid"] = lblgrdID.Value; dritem["Item_Code"] = (txtgrdItem_Code.Text.Replace(",", " ")); dritem["Item_Short_Desc"] = (txtItemDescription.Text.Replace(",", " ")); dritem["ORDER_QTY"] = (txtgrdItemReqQty.Text.Trim() == "" ? "0" : txtgrdItemReqQty.Text.Trim()); dritem["ORDER_PRICE"] = (txtUnitPrice.Text.Trim() == "" ? "0" : txtUnitPrice.Text.Trim()); dritem["Item_Discount"] = (txtDiscount.Text.Trim() == "" ? "0" : txtDiscount.Text.Trim()); dritem["Unit"] = (txtUnit.Text.Trim() == "" ? "" : txtUnit.Text.Trim()); dritem["Item_Long_Desc"] = (txtgrdItemComent.Text.Replace(",", " ")); dtExtraItems.Rows.Add(dritem); inc++; } } int retval = 0; if (dtExtraItems.Rows.Count > 0) { retval = BLL_POLOG_Register.POLOG_Insert_Update_POItem(UDFLib.ConvertIntegerToNull(Request.QueryString["POID"].ToString()), dtExtraItems, UDFLib.ConvertIntegerToNull(Session["USERID"].ToString())); BindItems(); //string msgDraft = String.Format("parent.ReloadParent_ByButtonID();"); //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true); //lblError.Text = "Item(s) saved successfully."; //BindItems(); //UpdGrid.Update(); } else { lblError.Text = "Please provide Item description."; } }