Esempio n. 1
0
    protected void DiplomaEntReqList_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        MessageUserControl.TryRun(() =>
        {
            string errorList = "";

            bool result;
            int mark;
            int selectedIndex = (e.Item.FindControl("EntReqCourses") as DropDownList).SelectedIndex;
            result            = int.TryParse((e.Item.FindControl("MarkTextBox") as TextBox).Text.Trim(), out mark);

            if (!result)
            {
                errorList += "- Marks entered must be whole numbers. \\n";
            }

            if (mark < 0 || mark > 100)
            {
                errorList += "- Marks must be whole numbers between 1 - 99. \\n";
            }
            if (selectedIndex == 0)
            {
                errorList += "- You must select a course when inserting a new Entrance Requirement. \\n";
            }

            if (errorList != "")
            {
                e.Cancel = true;
                throw new Exception(errorList);
            }
        });
    }
Esempio n. 2
0
    protected void LvMDoc_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        string       slno      = Convert.ToString(LvMDoc.Items.Count + 1);
        string       mdoc      = "";
        string       title     = "";
        string       inventor1 = "";
        string       status    = "";
        DropDownList ddl       = e.Item.FindControl("ddlNewMdocNo") as DropDownList;

        mdoc = ddl.SelectedValue;
        if (mdoc != "")
        {
            TextBox txt;
            txt       = e.Item.FindControl("txtTitle") as TextBox;
            title     = txt.Text;
            txt       = e.Item.FindControl("txtOwner") as TextBox;
            inventor1 = txt.Text;
            txt       = e.Item.FindControl("txtStatus") as TextBox;
            status    = txt.Text;


            DataTable dt = (DataTable)ViewState["MDOC"];
            DataRow   dr = dt.NewRow();
            dr["SNO"]                = slno;
            dr["ContractNo"]         = mdoc;
            dr["Title"]              = title;
            dr["CoordinatingPerson"] = inventor1;
            dr["Status"]             = status;

            dt.Rows.Add(dr);
            LvMDoc.DataSource = (DataTable)ViewState["MDOC"];
            LvMDoc.DataBind();
        }
    }
Esempio n. 3
0
        //  Display USER records
        protected void lstAllUsers_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            USER    user = new USER();
            TextBox tbx  = (e.Item.FindControl("tbxUserName")) as TextBox;

            if (tbx != null)
            {
                user.Username = tbx.Text;
            }
            tbx = (e.Item.FindControl("tbxPassword")) as TextBox;
            if (tbx != null)
            {
                user.Password = tbx.Text;
            }
            tbx = (e.Item.FindControl("tbxFirstname")) as TextBox;
            if (tbx != null)
            {
                user.Firstname = tbx.Text;
            }
            tbx = (e.Item.FindControl("tbxSurname")) as TextBox;
            if (tbx != null)
            {
                user.Surname = tbx.Text;
            }
            UpdateUserRecord(user, "Add");
            ResetUserView();
        }
Esempio n. 4
0
 protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (_objCheckPermision.Permission(_objCheckPermision.LayQuyen("strNCC_Them")))
     {
         if (ValidateData())
         {
             var t0 = new Partner
             {
                 ID             = int.Parse(SupplierID),
                 Name           = Name,
                 Address        = _address,
                 Email          = _email,
                 Tel            = Phone,
                 Phone          = Mobile,
                 BankNumber     = _bankNumber,
                 BankName       = _bankName,
                 PartnerGroupID = (int)PartnerEnum.Supplier
             };
             NewsFactory.Insert(t0);
             lv_ThongTinSP.EditIndex = -1;
             BinList();
             ltr_Notice.Text = objComm.ShowNotice(true, "Thêm mới nhà cung cấp thành công!");
         }
     }
     else
     {
         iRightAccess.Visible = false;
         objControl.LoadMyControl(idNotPermissionAccess, NotPermissControl);
     }
 }
Esempio n. 5
0
    protected void CourseList_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        MessageUserControl.TryRun(() =>
        {
            string errorList = "";
            bool checkCourse;
            PathwaysController controller = new PathwaysController();

            string courseName = (e.Item.FindControl("SubjectNameTextBox") as TextBox).Text;

            checkCourse = controller.CheckSubjectName(courseName);

            if (courseName.Length > 150)
            {
                errorList += "- The Subject name cannot exceed 150 characters. \\n";
            }

            if (checkCourse == false)
            {
                errorList += "- The Subject Name selected currently exists in the system, and cannot be repeated.\\n";
            }
            if (errorList != "")
            {
                e.Cancel = true;
                throw new Exception(errorList);
            }
        });
    }
        protected void ServiceDetailPartList_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            MessageUserControl.TryRun(() =>
            {
                e.Values["ServiceDetailID"] = int.Parse(ViewServiceDetailID.Value);

                if (String.IsNullOrWhiteSpace((string)e.Values["PartID"]))
                {
                    e.Cancel = true;
                    throw new Exception("Must provide partID.");
                }
                if (String.IsNullOrWhiteSpace((string)e.Values["Quantity"]))
                {
                    e.Cancel = true;
                    throw new Exception("Must provide quantity.");
                }
                if (!String.IsNullOrWhiteSpace((string)e.Values["PartID"]) && (!int.TryParse((string)e.Values["PartID"], out int partID) || partID < 0))
                {
                    e.Cancel = true;
                    throw new Exception(" PartID must be a positive whole number.");
                }
                if (!String.IsNullOrWhiteSpace((string)e.Values["Quantity"]) && (!int.TryParse((string)e.Values["Quantity"], out int qty) || qty < 0))
                {
                    e.Cancel = true;
                    throw new Exception(" Quantity must be a positive whole number.");
                }
            }, "Success", "New part added, if the service is started then inventory will be adjusted according to the changes");
        }
Esempio n. 7
0
    protected void PresupuestoCodigos_ListView_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        // solo cuando la CantNiveles es mayor que 1, el usuario debe seleccionar un código en la lista

        if (int.Parse(CantidadNiveles_DropDownList.Text.ToString()) > 1)
        {
            if (NivelesPrevios_ListBox.SelectedIndex == -1)
            {
                // el usuario no seleccionó el nivel previo en la lista
                ErrMessage_Span.InnerHtml        = "Ud. debe seleccionar un código en la lista que servirá como grupo (o nivel de agrupación) para los niveles que desea agregar ahora.";
                ErrMessage_Span.Style["display"] = "block";
            }
            else
            {
                // concatenamos el nivel que el usuario indicó con el nivel previo. De esa forma, el código
                // quedará así: 10-10, 10-10-10, ...
                e.Values["Codigo"] = NivelesPrevios_ListBox.SelectedValue + "-" + e.Values["Codigo"];
            }
        }
        // nótese como aquí le damos valor a los items que no se muestran al usuario: CantNiveles,
        // GrupoFlag y CiaContab; estos valores fueron indicados en la parte superior de la página

        e.Values["CantNiveles"] = System.Int16.Parse(CantidadNiveles_DropDownList.Text);
        e.Values["CiaContab"]   = int.Parse(CiasContab_DropDownList.SelectedValue);
        // e.Values["GrupoFlag"] = Grupo_CheckBox.Checked;
    }
    protected void ListViewPostComment_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        ListView lv = (ListView)sender;


        Panel lvi = (Panel)lv.Parent;

        raceKey = new Guid(((Label)lvi.FindControl("RaceIdLabel")).Text);
        string  post_userId = ((Label)lvi.FindControl("UserIdLabel")).Text;
        TextBox txtb        = (e.Item.FindControl("RaceCommentTextBox")) as TextBox;


        string connectionString = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
        string insertSql        = "INSERT INTO RaceComments(RaceComment, RaceId, RaceCommentUser,CommentUserId,RaceCommentUserName) VALUES(@RaceComment, @RaceId, @RaceCommentUser,@CommentUserId,@RaceCommentUserName)";

        using (SqlConnection myConnection = new SqlConnection(connectionString))
        {
            myConnection.Open();
            SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
            myCommand.Parameters.AddWithValue("@RaceComment", txtb.Text.Trim());
            myCommand.Parameters.AddWithValue("@RaceId", raceKey);



            myCommand.Parameters.AddWithValue("@CommentUserId", currentUserId);


            myCommand.Parameters.AddWithValue("@RaceCommentUser", HttpContext.Current.Session["user"]);
            myCommand.Parameters.AddWithValue("@RaceCommentUserName", User.Identity.Name);

            myCommand.ExecuteNonQuery();
            myConnection.Close();
        }

        if (currentUserId.ToString() != post_userId)
        {
            string connectionString12 =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


            string insertSql2 = "INSERT INTO Notifications(UserId,Type,NotifyTo,PostId) VALUES(@UserId,@Type,@NotifyTo,@PostId)";

            using (SqlConnection myConnection = new SqlConnection(connectionString12))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);

                myCommand.Parameters.AddWithValue("@Type", "Race_Comment");
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);
                myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);

                myCommand.Parameters.AddWithValue("@PostId", raceKey);
                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
        }

        e.Cancel = true;
        this.DataBind();
    }
Esempio n. 9
0
 protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strThuongHieu_Them")))
     {
         var t0  = new Brand();
         var txt = (e.Item.FindControl("txtName")) as TextBox;
         if (txt != null)
         {
             t0.Name = txt.Text;
         }
         txt = (e.Item.FindControl("txtNote")) as TextBox;
         if (txt != null)
         {
             t0.Name = txt.Text;
         }
         BrandDAO.Insert(t0);
         this.lv_ThongTinSP.EditIndex = -1;
         this.BinList();
     }
     else
     {
         this.iRightAccess.Visible = false;
         this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl);
     }
 }
Esempio n. 10
0
        protected void topicsListView_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            var topicNameTextBox = this.topicsListView.InsertItem.FindControl("name") as TextBox;

            if (!SecurityContext.IsAuthenticated)
            {
                throw new NotAuthorizedException();
            }

            try
            {
                var subject = SubjectService.Get(CustomConvert.ToInt32(this.subjectId.Value));
                var topic   = new Topic(topicNameTextBox.Text, subject, SecurityContext.User);

                TopicService.Create(topic);
                TopicService.CommitChanges();
                Response.RedirectToRoute("SubjectTopics", new { subjectId = this.subjectId.Value });
            }
            catch
            {
                //handle exception
                this.message.InnerText = GenericErrorMessage;
                this.message.Visible   = true;
            }
        }
 private void SupplementalObservationList_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     IbaMasterPage.ExceptionHandler(Master, () =>
     {
         e.Values.Add("EventId", this.UserState.SiteVisit.Id);
     });
 }
Esempio n. 12
0
        protected void ListViewCities_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            this.LabelCityErrors.Text = string.Empty;

            try
            {
                string cityName = (e.Item.FindControl("CityNameTextBox") as TextBox).Text;
                this.ValidateName(cityName);

                float  latitude;
                string latitudeAsString = (e.Item.FindControl("LatitudeTextBox") as TextBox).Text;
                this.ValidateGeoCoordinate(latitudeAsString, out latitude);

                float  longitude;
                string longitudeAsString = (e.Item.FindControl("LongitudeTextBox") as TextBox).Text;
                this.ValidateGeoCoordinate(longitudeAsString, out longitude);

                int    population;
                string populationAsString = (e.Item.FindControl("PopulationTextBox") as TextBox).Text;
                this.ValidatePopulation(populationAsString, out population);

                var countryId = this.GridViewCountries.SelectedDataKey.Value.ToString();

                this.EntityDataSourceCities.InsertParameters.Add("CountryId", TypeCode.String, countryId);

                this.ListViewCities.DataBind();
            }
            catch (Exception ex)
            {
                this.LabelCityErrors.Text = ex.Message;
                e.Cancel = true;
            }
        }
    }     // eom

    protected void UserListView_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        //you need to walk through the checkbox list


        //create the RoleMembership string List<> of selected rows
        var addtoroles = new List <string>();

        //point to the physical checkbox list control
        var roles = e.Item.FindControl("RoleMemberships") as CheckBoxList;

        //does the control exist - safety check
        if (roles != null)
        {
            //1. cycle through the checkboxlist
            foreach (ListItem role in roles.Items)
            {
                //2. find roles that were checked
                if (role.Selected)
                {//is it checked?
                    //3. add to the List<string>
                    addtoroles.Add(role.Value);
                }
                //4. assign the List<string> to the inserting instance represented by e
                e.Values["RoleMemberships"] = addtoroles;
            }
        }
    }
Esempio n. 14
0
        protected void lv_Adjust_Advances_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            try
            {
                GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();
                LinkButton lkbInsert        = (e.Item.FindControl("lkbInsert")) as LinkButton;
                if (lkbInsert.CommandName == "Insert")
                {
                    uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType");
                    obj.ReturnType  = ReturnType;
                    obj.SectionType = (byte)EnumConstants.OfflineExcelSection.AdvanceAdjustment;
                    if (uc_SupplyType.ddlPos_SelectedIndex > 0)
                    {
                        obj.PlaceofSupply = Convert.ToByte(uc_SupplyType.ddlPos_SelectedValue);
                    }

                    if (uc_SupplyType.ddlSupplyType_SelectedIndex > 0)
                    {
                        obj.SupplyType = Convert.ToByte(uc_SupplyType.ddlSupplyType_SelectedValue);
                    }
                }
                obj.UserID      = Common.LoggedInUserID();
                obj.CreatedDate = DateTime.Now;
                obj.CreatedBy   = Common.LoggedInUserID();
                unitOfwork.OfflineinvoiceRepository.Create(obj);
                unitOfwork.Save();
                lv_Adjust_Advances.EditIndex = -1;
                BindItems(ReturnType);
            }
            catch (Exception ex) {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
Esempio n. 15
0
        protected void UnorderedCart_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            // Push Purchase Order Number into Unordered Cart Items
            e.Values[0] = PONumLabel.Text;



            MessageUserControl.TryRun(() =>
            {
                if (String.IsNullOrWhiteSpace((string)e.Values[1]))
                {
                    e.Cancel = true;
                    throw new Exception("Must provide description.");
                }
                if (String.IsNullOrWhiteSpace((string)e.Values[2]))
                {
                    e.Cancel = true;
                    throw new Exception("Must provide Vendor Part Name.");
                }

                if (!int.TryParse((string)e.Values[3], out int qty) || qty < 0)
                {
                    e.Cancel = true;
                    throw new Exception("unordered quantity must be a positive whole number.");
                }
            }, "Insert Sucessfull", "Unordered part sucesfully added to the return cart");
        }
Esempio n. 16
0
        protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhanVien_Them")))
            {
                if (this.ValidateData())
                {
                    var t0 = new Employee
                    {
                        Alias    = this.Alias,
                        Name     = this.hoTen,
                        TeamID   = Int32.Parse(this.nhomNV.SelectedValue),
                        BranchID = Int32.Parse(this.chiNhanhID.SelectedValue),
                        DOB      =
                            DateTime.ParseExact(
                                this.ngaySinh, "dd/MM/yyyy", CultureInfo.InvariantCulture),
                        Gender     = true,
                        Created    = DateTime.Now,
                        LuongCoBan = 0,
                        TheoDoi    = true
                    };
                    if (this.img_AnhNhanVien1 != null)
                    {
                        t0.Picture = this.img_AnhNhanVien1.Src;
                    }

                    EmployeeDAO.Insert(t0);
                    this.BinList();
                }
            }
            else
            {
                this.iRightAccess.Visible = false;
                this.objControl.LoadMyControl(this.idNotPermissionAccess, this.NotPermissControl);
            }
        }
Esempio n. 17
0
    protected void lvActivity_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
        string  slno         = Convert.ToString(lvActivity.Items.Count + 1);
        string  activityDt   = "";
        string  channel      = "";
        string  activityType = "";
        string  remarks      = "";
        TextBox txt;

        txt          = e.Item.FindControl("txtActivityDt") as TextBox;
        activityDt   = txt.Text;
        txt          = e.Item.FindControl("txtChannel") as TextBox;
        channel      = txt.Text;
        txt          = e.Item.FindControl("txtActivityType") as TextBox;
        activityType = txt.Text;
        txt          = e.Item.FindControl("txtActivityDetails") as TextBox;
        remarks      = txt.Text;
        if (activityDt != "" && channel != "")
        {
            DataTable dt = (DataTable)ViewState["MktActivity"];
            DataRow   dr = dt.NewRow();
            dr["slno"]         = slno;
            dr["ActivityDt"]   = Convert.ToDateTime(activityDt);
            dr["Channel"]      = channel;
            dr["ActivityType"] = activityType;
            dr["Remarks"]      = remarks;
            dt.Rows.Add(dr);
            lvActivity.DataSource = (DataTable)ViewState["MktActivity"];
            lvActivity.DataBind();
        }
    }
        void lvAttributeValues_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            PlaceHolder phInsertValue = lvAttributeValues.InsertItem.FindControl("phInsertValue") as PlaceHolder;

            if (phInsertValue != null && phInsertValue.Controls.Count == 1)
            {
                string value = _attribute.FieldType.Field.GetEditValue(phInsertValue.Controls[0], _attribute.QualifierValues);

                var attributeValueService = new AttributeValueService();
                var attributeValue        = new AttributeValue();
                attributeValue.AttributeId = _attribute.Id;
                attributeValue.EntityId    = _model.Id;
                attributeValue.Value       = value;

                int?maxOrder = attributeValueService.Queryable().
                               Where(a => a.AttributeId == attributeValue.AttributeId &&
                                     a.EntityId == attributeValue.EntityId).
                               Select(a => ( int? )a.Order).Max();

                attributeValue.Order = maxOrder.HasValue ? maxOrder.Value + 1 : 0;

                attributeValueService.Add(attributeValue, _currentPersonId);
                attributeValueService.Save(attributeValue, _currentPersonId);
                _model.LoadAttributes();
            }

            lvAttributeValues.EditIndex = -1;
            BindData();
        }
Esempio n. 19
0
        protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.InsertItem)
            {
                TextBox ywycode = (TextBox)ListView1.InsertItem.FindControl("YwyCodeTextBox");
                if (ywycode.Text.Trim().Length == 0)
                {
                    e.Cancel = true;
                    Show(this, "请输入业务员代码");
                    return;
                }

                TextBox ywyname = (TextBox)ListView1.InsertItem.FindControl("YwyNameTextBox");
                if (ywyname.Text.Trim().Length == 0)
                {
                    e.Cancel = true;
                    Show(this, "请输入业务员姓名");
                    return;
                }
                string insertsql = "INSERT INTO YwyInfo(YwyCode, YwyName, OrganizeID) VALUES ('"
                                   + ywycode.Text.Trim() + "','"
                                   + ywyname.Text.Trim() + "',"
                                   + Session["OrganizeID"].ToString() + ")";
                SqlDataSource1.InsertCommand = insertsql;
            }
        }
    protected void UserListView_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        //one needs to walk through the checkboxlist

        //create the RoleMembership string List<> of selected roles
        var addtoroles = new List <string>();

        //point to the phyiscal checkboxlist control
        var roles = e.Item.FindControl("RoleMemberships") as CheckBoxList;

        //does the control exist  -safety check
        if (roles != null)
        {
            //cycle through the checkboxlist
            //find which roles have been selected (checked)
            //add to the List<string>
            //assign the List<string> to the inserting instance
            //     represented by e
            foreach (ListItem role in roles.Items)
            {
                if (role.Selected)
                {
                    addtoroles.Add(role.Value);
                }
                e.Values["RoleMemberships"] = addtoroles;
            }
        }
    }
Esempio n. 21
0
 protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (_objCheckPermision.Permission(_objCheckPermision.LayQuyen("strChiNhanh_Them")))
     {
         var t0  = new DAO.Branch();
         var txt = (e.Item.FindControl("txt_Name")) as TextBox;
         if (txt != null)
         {
             t0.Name = txt.Text;
         }
         txt = (e.Item.FindControl("txt_Name")) as TextBox;
         if (txt != null)
         {
             t0.Name = txt.Text;
         }
         ChiNhanhDAO.Insert(t0);
         lv_ThongTinSP.EditIndex = -1;
         BinList();
     }
     else
     {
         iRightAccess.Visible = false;
         ObjControl.LoadMyControl(idNotPermissionAccess, NotPermissControl);
     }
 }
Esempio n. 22
0
        protected void lvStruttura_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            var nodename = (e.Item.FindControl("tbNodeName") as TextBox).Text;
            int?parentid = null;

            if (!string.IsNullOrEmpty(hfParentID.Value))
            {
                parentid = Convert.ToInt32(hfParentID.Value);
            }

            try
            {
                var ruolo = UserManager.getRuolo(this);
                ProjectTreeStructure = _manager.AddNode(
                    ProjectTreeStructure, parentid, nodename, hfStrutturaID.Value, InformazioniUtente, ruolo);

                tbNumNodiStruttura.Text = GetNodesNumber();
            }
            catch (Exception ex)
            {
                e.Cancel = true;
                MessageBox(ex.Message);
            }

            if (!e.Cancel)
            {
                lvStruttura_ItemCanceling(null, null);
            }
        }
Esempio n. 23
0
 protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomChucNang_Them")))
     {
         var it  = new TBT_AdminFunctionGroup();
         var txt = (e.Item.FindControl("txt_FunctionGroupName")) as TextBox;
         if (txt != null)
         {
             it.FunctionGroupName = txt.Text;
         }
         var txt1 = (e.Item.FindControl("txt_FunctionGroupOrder")) as ASPxTextBox;
         if (txt1 != null)
         {
             it.FunctionGroupOrder = Int32.Parse(txt1.Text);
         }
         txt = (e.Item.FindControl("txt_FunctionGroupDesc")) as TextBox;
         if (txt != null)
         {
             it.FunctionGroupDesc = txt.Text;
         }
         MemberGroupDAO.ThemNhomChucNang(it);
         this.lv_ThongTinSP.EditIndex = -1;
         this.BinList();
     }
     else
     {
         this.iRightAccess.Visible = false;
         this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl);
     }
 }
        protected void ListViewTodos_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            object categoryId = "CategoryId";
            e.Values[categoryId] = int.Parse(this.ListBoxCategories.SelectedValue.ToString());

            object lastChange = "LastChange";
            e.Values[lastChange] = DateTime.Now;
        }
Esempio n. 25
0
 protected void AllComments_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (Session["UserID"] == null)
     {
         Response.Write("<script>alert('您还没有登录或登录信息失效,请登陆后评论!');</script>");
         e.Cancel = true;
     }
 }
Esempio n. 26
0
    protected void lvContact_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        string  slno     = "";
        string  contact  = "";
        string  business = "";
        string  address1 = "";
        string  address2 = "";
        string  phoneNo1 = "";
        string  phoneNo2 = "";
        string  emailID  = "";
        TextBox txt;

        txt      = e.Item.FindControl("txtNewContact") as TextBox;
        contact  = txt.Text;
        txt      = e.Item.FindControl("txtNewBusiness") as TextBox;
        business = txt.Text;
        txt      = e.Item.FindControl("txtNewAddress1") as TextBox;
        address1 = txt.Text;
        txt      = e.Item.FindControl("txtNewAddress2") as TextBox;
        address2 = txt.Text;
        txt      = e.Item.FindControl("txtNewPhone1") as TextBox;
        phoneNo1 = txt.Text;
        txt      = e.Item.FindControl("txtNewPhone2") as TextBox;
        phoneNo2 = txt.Text;
        txt      = e.Item.FindControl("txtNewEmail") as TextBox;
        emailID  = txt.Text;
        DataTable dt = (DataTable)ViewState["ContactTable"];

        if (dt.Rows.Count > 0)
        {
            DataRow drSl = dt.Rows[dt.Rows.Count - 1];
            if (drSl.RowState == DataRowState.Deleted)
            {
                slno = (Convert.ToInt32(drSl["slno", DataRowVersion.Original]) + 1).ToString();
            }
            else
            {
                slno = (Convert.ToInt32(drSl["slno"]) + 1).ToString();
            }
        }
        else
        {
            slno = "1";
        }
        DataRow dr = dt.NewRow();

        dr["slno"] = slno;
        dr["ContactPersonName"] = contact;
        dr["BusinessArea"]      = business;
        dr["Address1"]          = address1;
        dr["Address2"]          = address2;
        dr["PhoneNo1"]          = phoneNo1;
        dr["PhoneNo2"]          = phoneNo2;
        dr["EmailID"]           = emailID;
        dt.Rows.Add(dr);
        lvContact.DataSource = (DataTable)ViewState["ContactTable"];
        lvContact.DataBind();
    }
Esempio n. 27
0
        protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            DropDownList ddl = (DropDownList)ListView1.InsertItem.FindControl("DropDownList1");

            e.Values["FK_Users_Message_Recipient"] = ddl.SelectedValue;
            DropDownList ddl2 = (DropDownList)ListView1.InsertItem.FindControl("DropDownList2");

            e.Values["FK_Users_Message_sender"] = ddl.SelectedValue;
        }
Esempio n. 28
0
 protected void lsv_SetupPage_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 29
0
 protected void lv_HienThi_ItemInserting(object sender, ListViewInsertEventArgs e)
 {
     if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strKhachHang_Them")))
     {
         var t0       = new Partner();
         var txtAlias = (e.Item.FindControl("txtAlias")) as ASPxTextBox;
         if (txtAlias != null)
         {
             t0.Alias = txtAlias.Text;
         }
         if (txtAlias != null && NewsFactory.Any(t0.Alias))
         {
             this.ltr_Notice.Text = this.objComm.ShowNotice(false, "Trung ma!");
             return;
         }
         var txtName = (e.Item.FindControl("txtName")) as ASPxTextBox;
         if (txtName != null)
         {
             t0.Name = txtName.Text;
         }
         var txtAddress = (e.Item.FindControl("txtAddress")) as ASPxTextBox;
         if (txtAddress != null)
         {
             t0.Address = txtAddress.Text;
         }
         var txtTel = (e.Item.FindControl("txtTel")) as ASPxTextBox;
         if (txtTel != null)
         {
             t0.Tel = txtTel.Text;
         }
         var txtPhone = (e.Item.FindControl("txtPhone")) as ASPxTextBox;
         if (txtPhone != null)
         {
             t0.Phone = txtPhone.Text;
         }
         var txtNote = (e.Item.FindControl("txtNote")) as ASPxTextBox;
         if (txtNote != null)
         {
             t0.Note = txtNote.Text;
         }
         t0.IsCare         = false;
         t0.Active         = true;
         t0.IsDelete       = false;
         t0.Created        = DateTime.Now;
         t0.PartnerGroupID = (int)PartnerEnum.Delievery;
         NewsFactory.Insert(t0);
         this.lv_HienThi.EditIndex = -1;
         this.BinList();
     }
     else
     {
         this.iRightAccess.Visible = false;
         this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl);
     }
 }
Esempio n. 30
0
    protected void ManagePhotoAlbumListView_ItemInserting(object sender, ListViewInsertEventArgs e)
    {
        FileUpload FileUpload1 = (FileUpload)ManagePhotoAlbumListView.InsertItem.FindControl("FileUpload1");

        if (!FileUpload1.HasFile || !FileUpload1.FileName.ToLower().EndsWith(".jpg"))
        {
            CustomValidator cusValImage = (CustomValidator)ManagePhotoAlbumListView.InsertItem.FindControl("cusValImage");
            cusValImage.IsValid = false;
            e.Cancel            = true;
        }
    }