Пример #1
0
 protected void lvStateSettings_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     //取消请求执行自定义的方法
     e.Cancel = true;
     //检测是否含有session
     if (Session.Count < 5)
     {
         //跳转
         Response.Redirect("/Account/Login", true);
         //停止加载后续内容
         Response.End();
         //直接返回
         return;
     }
     //当前用户所在部门
     string deptName = Session["dept_name"].ToString();
     //当前角色id
     Int16 roleId = Convert.ToInt16(Session["role_id"]);
     //检测是否有权限
     if ((deptName != mustDeptName && deptName != "样板") || (roleId != 0 && roleId != 1 && roleId != 6))
     {
         throw new Exception("您没有添加记录权限!");
     }
     //设置录入员姓名和时间
     e.Values["add_person"] = Session["user_name"].ToString();
     e.Values["add_time"] = DateTime.Now;
     e.Values["last_change_time"] = DateTime.Now;
     //允许执行删除数据
     e.Cancel = false;
 }
Пример #2
0
    protected void lvEducation_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        String InstitutionName = "", DegreeTitle = "", Category = "", Batch = "";

        TextBox txtInstitutionName = (TextBox)e.Item.FindControl("txtInstitution") as TextBox;
        TextBox txtDegreeTitle = (TextBox)e.Item.FindControl("txtDegree") as TextBox;
        DropDownList DDCategory = (DropDownList)e.Item.FindControl("DDCategory") as DropDownList;
        TextBox txtBatch = (TextBox)e.Item.FindControl("txtBatch") as TextBox;

        InstitutionName = txtInstitutionName.Text;
        DegreeTitle = txtDegreeTitle.Text;
        Category = DDCategory.Text;
        Batch = txtBatch.Text;

        String PK = gObj.getNextPK("Education");

        String cmdStr = "Insert into Education values ('" + myUserID + "', '" + Category + "'," +
            " '" + Batch + "', '" + DegreeTitle + "', '" + InstitutionName + "', '" + PK + "')";
        SqlCommand scom = new SqlCommand(cmdStr, con);

        con.Open();

        Boolean flg = false;   //If there is an error no PostBack//

        if ((InstitutionName == "") || (DegreeTitle == "") || (Category == "") || (Batch == ""))
        {
            lblErrorInsert.Text = "Check the Entries, Date should be (MM/DD/YYYY)";
            lblErrorInsert.Visible = true;
            flg = true;
        }

        try
        {
            if (!flg)
            {
                scom.ExecuteNonQuery();
            }
        }

        catch
        {
            //Most Probably it is the date issue//
            //Give a msg saying the date should be in correct format//
            //And Recheck other entries//

            lblErrorInsert.Text = "Check the Entries, Date should be (MM/DD/YYYY)";
            lblErrorInsert.Visible = true;
            flg = true;
        }

        finally
        {
            con.Close();
        }

        if (!flg)
        {
            Server.Transfer("editEducation.aspx");
        }
    }
        protected void lvLoanInterestedRate_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository();
            StoreProRepository storeFacade = new StoreProRepository();

            RadNumericTextBox monthRate = (lvLoanInterestedRate.InsertItem.FindControl("radMonthRate")) as RadNumericTextBox;
            TextBox rateDisplay = (lvLoanInterestedRate.InsertItem.FindControl("tbRateDisplay")) as TextBox;
            RadNumericTextBox rnbVNDRate = (lvLoanInterestedRate.InsertItem.FindControl("rnbVNDRate")) as RadNumericTextBox;
            RadNumericTextBox rnbUSDRate = (lvLoanInterestedRate.InsertItem.FindControl("rnbUSDRate")) as RadNumericTextBox;

            if ((Int16)monthRate.Value <= 0)
            {
                RadWindowManager1.RadAlert("Deposite Rate is required!", 340, 150, "Alert", null);
                return;
            }

            BLOANINTEREST_KEY intKey = new BLOANINTEREST_KEY();
            intKey.MonthLoanRateNo = (Int16)monthRate.Value;
            intKey.USD_InterestRate = (decimal)rnbUSDRate.Value;
            intKey.VND_InterestRate = (decimal)rnbVNDRate.Value;
            intKey.LoanInterest_Key = rateDisplay.Text;
            intKey.Id = (Int16)monthRate.Value;
            storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(intKey.MonthLoanRateNo, intKey.VND_InterestRate, intKey.USD_InterestRate, this.UserId, 1);

            facade.Add(intKey);
            facade.Commit();
            LoadDataTolvLoanInterestedRate();
        }
Пример #4
0
 protected void lvContacts_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     DropDownList ddl = e.Item.FindControl("ddlInsertCompany") as DropDownList;
     if (ddl != null)
     {
         e.Values["Customer"] = ddl.SelectedValue;
     }
 }
 protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     FileUpload FileUpload1 = (FileUpload)ListView1.InsertItem.FindControl("FileUpload1");
     if (!FileUpload1.HasFile || !FileUpload1.FileName.ToLower().EndsWith(".jpg"))
     {
       CustomValidator cusValImage = (CustomValidator)ListView1.InsertItem.FindControl("cusValImage");
       cusValImage.IsValid = false;
       e.Cancel = true;
     }
 }
 protected void lstSubCat_OnItemInserting(object sender, ListViewInsertEventArgs e)
 {
     ListViewItem item = e.Item;
     DropDownList Category = (DropDownList)item.FindControl("dropCategory");
     // Verify if the type of item is an insert and page is valid.
     if (item.ItemType == ListViewItemType.InsertItem && Page.IsValid)
     {
         dsSubCategory.InsertParameters.Add("category_id", Category.Text);
     }
 }
Пример #7
0
 protected void on_item_inserting(object sender, ListViewInsertEventArgs e)
 {
     var fupload = (FileUpload)lvModify.InsertItem.FindControl("fupload");
     if (fupload.HasFile)
     {
         fupload.SaveAs(@"C:\HostingSpaces\jwaldron\lasubu.com\wwwroot\Images\store\" + DateTime.Now.ToString("yyyyMMddHHmmss") + fupload.FileName);
         var imageUrl = "Images\\store\\" + DateTime.Now.ToString("yyyyMMddHHmmss") +fupload.FileName;
         e.Values["ImageURL"] = imageUrl;
     }
 }
        protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            DropDownList ddl = ListView1.InsertItem.FindControl("DropDownList1") as DropDownList;
            if (ddl != null)
                e.Values["stanowisko_id"] = ddl.SelectedValue;

            // Dział
            DropDownList ddl2 = ListView1.InsertItem.FindControl("DropDownList2") as DropDownList;
            if (ddl2 != null)
                e.Values["dzial_id"] = ddl2.SelectedValue;
        }
Пример #9
0
 protected void CusOEMList_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     OEMCus oem = new OEMCus();
     oem.BaanId = Convert.ToInt32(BaanOEMID.Text);
     oem.salesmanId = Convert.ToInt32(SalesmanID.Text);
     oem.CusOEM = ((TextBox)e.Item.FindControl("cusOEM")).Text.Trim();
     oem.viewSalesmanId = Convert.ToInt32(ViewSalesmanID.Text);
     oem.isValid = ((CheckBox)e.Item.FindControl("isValid")).Checked;
     if (oem.CusOEM != "")
     {
         oem.Add();
     }
     resetCusOEMData();
 }
        /// <summary>
        /// Themes the view item inserting.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">
        /// The <see cref="System.Web.UI.WebControls.ListViewInsertEventArgs"/> 
        /// instance containing the event data.
        /// </param>
        protected void ThemeViewItemInserting(object sender, ListViewInsertEventArgs e)
        {
            if (FieldView.SelectedValue == null||e.Values["Title"]==null)
                e.Cancel = true;
            else
            {
                var groupValue = (DropDownList)ThemeView.InsertItem.FindControl("insertGroup");

                _selectedValue = groupValue.SelectedValue;
                _selectedId = groupValue.SelectedIndex;

                e.Values.Add("GroupName", _selectedValue);
                e.Values.Add("FieldId", FieldView.SelectedValue);
            }
        }
Пример #11
0
    protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        if (IsValid)
        {
            e.Values["FromMessagesID"] = MessagesID;
            e.Values["FromIp"] = Request.ServerVariables["REMOTE_ADDR"];
            e.Values["InDate"] = DateTime.Now;
            e.Values["Active"] = true;
            e.Values["Visits"] = 0;
            e.Values["SiteID"] = (int)drvvv.drvvvSettings.GetSite();

            //RegisterStartupScript("alert", "<script language='javascript'> { alert('הודעתך התקבלה בהצלחה, והיא תופיע בקרוב לאחר אישור המערכת');window.location = ''}</script>");
        }
        else
            e.Cancel = true;
    }
Пример #12
0
 protected void ListView1_ItemInserting(Object sender, ListViewInsertEventArgs e)
 {
     ////e.Item
     //// Iterate through the values to validate them.
     //foreach (DictionaryEntry de in e.Values)
     //{
     //    if (de.Value != null)
     //    {
     //        Trace.Write(de.Key + ": " + de.Value);
     //        //e.Cancel = true; //This cancels the update.
     //    }
     //    else
     //    {
     //        Trace.Write(de.Key + ": null");
     //    }
     //}
 }
Пример #13
0
    protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
    {

        if (((FileUpload)ListView1.InsertItem.FindControl("FileUploadImg")).HasFile)
        {
            string name;
            if (drvvv.GetFile.UploadFileUpload((FileUpload)ListView1.InsertItem.FindControl("FileUploadImg"), false, false, false, out name))
            {
                e.Values["Image"] = name;
                Label1.Text += "The item was successfully";
            }
            else
                Label1.Text += name;
        }
        e.Values["InDate"] = DateTime.Now;

        Label1.Text += "The item was successfully";
    }
Пример #14
0
        protected void lvRateExchange_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            ExchangeRatesRepository facade = new ExchangeRatesRepository();
            StoreProRepository storeFacade = new StoreProRepository();

            TextBox tbcurrency = (lvRateExchange.InsertItem.FindControl("tbCurrency")) as TextBox;
            RadNumericTextBox rnbVNDRate = (lvRateExchange.InsertItem.FindControl("rnbVNDRate")) as RadNumericTextBox;

            B_ExchangeRates exchangeRate = new B_ExchangeRates();

            exchangeRate.Rate = (decimal)rnbVNDRate.Value;
            exchangeRate.Currency = tbcurrency.Text;
            storeFacade.StoreProcessor().B_ExchangeRate_history_process(exchangeRate.Currency, exchangeRate.Rate, this.UserId, 1);

            facade.Add(exchangeRate);
            facade.Commit();
            LoadDataTolvRateExchange();
        }
Пример #15
0
    protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        FileUpload fileUpload = (FileUpload)ListView1.InsertItem.FindControl("FileUploadImage");
        if (fileUpload.HasFile)
        {
            string upload;
            if (drvvv.GetFile.UploadFileUpload(fileUpload, false, false, true, out upload))
                e.Values["LinkFile"] = upload;
            else
            {
                e.Cancel = true;
                Label1.Text = upload;
            }
            
            if (((DropDownList)ListView1.InsertItem.FindControl("DropDownListBannersSpace")).SelectedValue != "")
                e.Values["BannersSpaceID"] = int.Parse(((DropDownList)ListView1.InsertItem.FindControl("DropDownListBannersSpace")).SelectedValue);
            if (((DropDownList)ListView1.InsertItem.FindControl("DropDownListSiteID")).SelectedValue != "")
                e.Values["SiteID"] = int.Parse(((DropDownList)ListView1.InsertItem.FindControl("DropDownListSiteID")).SelectedValue);

            e.Values["InDate"] = DateTime.Now;
            e.Values["Link"] = drvvv.CatSummary.CompletionUrl(((TextBox)ListView1.InsertItem.FindControl("LinkTextBox")).Text); ;
        }
    }
        protected void lvLoanControl_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            DropDownList type = (lvLoanControl.InsertItem.FindControl("TypeTextBox")) as DropDownList;
            RadDatePicker date = (lvLoanControl.InsertItem.FindControl("DateTextBox")) as RadDatePicker;
            RadNumericTextBox amountAction = (lvLoanControl.InsertItem.FindControl("AmountActionTextBox")) as RadNumericTextBox;
            RadNumericTextBox rate = (lvLoanControl.InsertItem.FindControl("RateTextBox")) as RadNumericTextBox;
            RadNumericTextBox notext = (lvLoanControl.InsertItem.FindControl("NoTextBox")) as RadNumericTextBox;
            DropDownList freq = (lvLoanControl.InsertItem.FindControl("FreqTextBox")) as DropDownList;

            BNewLoanControl item = new BNewLoanControl();
            item.Type = type.SelectedValue;
            item.Date = date.SelectedDate;
            item.AmountAction = String.IsNullOrEmpty(amountAction.Text) ? 0 : Double.Parse(amountAction.Text);
            item.Rate = String.IsNullOrEmpty(rate.Text) ? 0 : Double.Parse(rate.Text);
            item.No = String.IsNullOrEmpty(notext.Text) ? 0 : Double.Parse(notext.Text);
            item.Freq = freq.Text;
            item.Code = tbNewNormalLoan.Text;
            item.PeriodRepaid = int.Parse(hfRepaymentTimes.Value);
            NewLoanControlRepository facade = new NewLoanControlRepository();
            facade.Add(item);
            facade.Commit();
            LoadDataTolvLoanControl();
        }
Пример #17
0
        protected void lvBets_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                var userId = context.Users.FirstOrDefault(u => u.UserName == Page.User.Identity.Name).UserId;
                var profileBsh = context.ProfilesBSHes.FirstOrDefault(p => p.UserId == userId);

                var expectedWinValue = e.Item.FindControl("expectedWinValue") as Label;
                var wonOrLost = e.Item.FindControl("wonOrLost") as Label;

                var bets = context.Bets.Where(b => b.ProfileId == profileBsh.ProfileId);

                foreach (var bet in bets)
                {
                    var matchId = bet.MatchId;
                    var factor = context.Factors.FirstOrDefault(f => f.MatchId == matchId);

                    if (bet.BetForecast == "1")
                    {
                        expectedWinValue.Text = Convert.ToInt32(bet.BetValue * factor.Win1).ToString();
                        wonOrLost.Text = "cd";
                    }

                    if (bet.BetForecast == "X")
                    {
                        expectedWinValue.Text = Convert.ToInt32(bet.BetValue * factor.X).ToString();
                        wonOrLost.Text = "cd";
                    }

                    if (bet.BetForecast == "2")
                    {
                        expectedWinValue.Text = Convert.ToInt32(bet.BetValue * factor.Win2).ToString();
                        wonOrLost.Text = "cd";
                    }
                }
            }
        }
Пример #18
0
 protected void lvCities_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     using (DBDataContext db = new DBDataContext())
     {
       string name = "";
       int DeliveryPrice = 0, FreeDelivery = 0;
       foreach (string key in e.Values.Keys)
       {
     if (e.Values[key] == null)
       continue;
     switch (key)
     {
       case "Name":
         name = e.Values[key].ToString();
         break;
       case "DeliveryPrice":
         int.TryParse(e.Values[key].ToString(), out DeliveryPrice);
         break;
       case "FreeDelivery":
         int.TryParse(e.Values[key].ToString(), out FreeDelivery);
         break;
     }
       }
       if (string.IsNullOrEmpty(name))
       {
     e.Cancel = true;
     return;
       }
       City c = new City();
       c.Name = name;
       c.FreeDelivery = FreeDelivery;
       c.DeliveryPrice = DeliveryPrice;
       db.Cities.InsertOnSubmit(c);
       db.SubmitChanges();
     }
     lvCities.EditIndex = -1;
 }
Пример #19
0
        protected void InsertTown(object sender, ListViewInsertEventArgs e)
        {
            var townName = (e.Item.FindControl("TownName") as TextBox).Text;
            var townCountryName = (e.Item.FindControl("TownCountryName") as TextBox).Text;
            var townPopulation = int.Parse((e.Item.FindControl("TownPopulation") as TextBox).Text);

            ContinentsEntities db = new ContinentsEntities();
            using (db)
            {
                var country = db.Countries.FirstOrDefault(c => c.name == townCountryName);

                if (country != null)
                {
                    db.Towns.Add(new Towns()
                    {
                        name = townName,
                        population = townPopulation,
                        countryId = country.id
                    });

                    db.SaveChanges();   
                }
            }
        }
Пример #20
0
        private void HandleInsert(ListViewItem item, bool causesValidation) {
            if (item != null && item.ItemType != ListViewItemType.InsertItem) {
                throw new InvalidOperationException(AtlasWeb.ListView_InvalidInsert);
            }

            if (causesValidation && Page != null && !Page.IsValid) {
                return;
            }

            if (item == null) {
                item = _insertItem;
            }
            if (item == null) {
                throw new InvalidOperationException(AtlasWeb.ListView_NoInsertItem);
            }

            DataSourceView view = null;
            bool isBoundToDataSourceControl = IsDataBindingAutomatic;

            if (isBoundToDataSourceControl) {
                view = GetData();
                if (view == null) {
                    throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ListView_NullView, ID));
                }
            }

            ListViewInsertEventArgs e = new ListViewInsertEventArgs(item);


            ExtractItemValues(e.Values, item, true/*includeKeys*/);
            

            OnItemInserting(e);

            if (e.Cancel) {
                return;
            }

            if (isBoundToDataSourceControl) {
                _insertValues = e.Values;
                view.Insert(e.Values, HandleInsertCallback);
            }
        }
 /// <summary>
 /// Fields the view item inserting.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">
 /// The <see cref="System.Web.UI.WebControls.ListViewInsertEventArgs"/> 
 /// instance containing the event data.</param>
 protected void FieldViewItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (e.Values["Title"]==null)
          e.Cancel = true;
 }
Пример #22
0
        protected void ChatListView_ItemInserting(object sender, ListViewInsertEventArgs e)
        {

        }
Пример #23
0
        protected void lvContainers_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            ContainerInfo c = (ContainerInfo)lvContainers.InsertItem.FindControl("ContainerInfo2");
            BusinessObjects.Container container = c.ContainerObject;

            q.Containers.Add(container);
            lvContainers.DataSource = q.Containers;
            lvContainers.InsertItemPosition = InsertItemPosition.None;
            lvContainers.DataBind();
            ViewState["Quote"] = q;
        }
Пример #24
0
        protected void AjustesListView_ItemInserting(object sender, System.Web.UI.WebControls.ListViewInsertEventArgs e)
        {
            Usuario usuario = (Usuario)Session["User"];

            e.Values["IdUsuario"] = usuario.Id;
        }
Пример #25
0
 /// <summary>
 /// TODO: Skriv beskrivning till CommentListView_ItemInserting.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void CommentListView_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     e.Values["PostId"] = Request.QueryString["id"];
 }
Пример #26
0
 protected void DetailListView_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     OpenDetialDialog();
 }
Пример #27
0
		protected override void OnItemInserting (ListViewInsertEventArgs e)
		{
			RecordEvent ("Enter");
			base.OnItemInserting (e);
			RecordEvent ("Leave");
		}
Пример #28
0
 protected virtual void OnItemInserting(ListViewInsertEventArgs e) {
     EventHandler<ListViewInsertEventArgs> handler = (EventHandler<ListViewInsertEventArgs>)Events[EventItemInserting];
     if (handler != null) {
         handler(this, e);
     }
     else {
         if (IsDataBindingAutomatic == false && e.Cancel == false) {
             throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ListView_UnhandledEvent, ID, "ItemInserting"));
         }
     }
 }
Пример #29
0
 /// <summary>
 /// make sure calculated fields are set on insert
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lvwTaskComments_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     e.Values["FK_Task"] = hdfSelectedTaskId.Value;
     e.Values["CreatedOn"] = DateTime.Now;
     e.Values["CreatedBy"] = Membership.GetUser() != null ? Membership.GetUser().ToString() : "anonymous";
 }
 protected void list3_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (e.Item.FindControl("newPN") != null)
     {
         string pn = ((TextBox)e.Item.FindControl("newPN")).Text.Trim();
         if (pn != "")
         {
             int oemid = Convert.ToInt32(selectedOEMID.Text);// Convert.ToInt32(((Label)list1.SelectedItem.FindControl("oemid")).Text);
             int sp = Convert.ToInt32(startFY.Text + "00") + Convert.ToInt32(startPeriod.Text);
             Forecast.updateforecastPN(sp, oemid, pn, 0, usr.sysUserId);
         }
     }
     loadList();
 }
 protected void lvwSitemapData_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
 }
Пример #32
0
 protected void UsuariosListView_ItemInserting(object sender, System.Web.UI.WebControls.ListViewInsertEventArgs e)
 {
     e.Values["Senha"] = HashingUtils.Hash((string)e.Values["SenhaPlain"]);
 }