コード例 #1
0
ファイル: ListViewItem.cs プロジェクト: bnantz/NCS-V1-1
        protected override bool OnBubbleEvent(object sender, EventArgs e)
        {
            CommandEventArgs ce = e as CommandEventArgs;

            if (ce != null) {
                ListViewCommandEventArgs lce = new ListViewCommandEventArgs(this, sender, ce);
                RaiseBubbleEvent(this, lce);

                return true;
            }
            return false;
        }
コード例 #2
0
 /// <summary>
 /// Toggle time series for soil
 /// </summary>
 protected void OnItemCommandSOIL(object sender, ListViewCommandEventArgs e)
 {
     onItemCommand(sender, e, MediumFilter.Medium.Soil);
 }
コード例 #3
0
    protected void lstChildMyTag_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        HiddenField hdnPkId           = (HiddenField)e.Item.FindControl("hdnPkId");
        HiddenField hdnTableName      = (HiddenField)e.Item.FindControl("hdnTableName");
        Label       lblEmailId        = (Label)e.Item.FindControl("lblEmailId");
        Label       lblGroupName      = (Label)e.Item.FindControl("lblGroupName");
        HiddenField hdnrequserid      = (HiddenField)e.Item.FindControl("hdnrequserid");
        HiddenField hdnRegistrationId = (HiddenField)e.Item.FindControl("hdnRegID");
        LinkButton  lnkstrLink        = (LinkButton)e.Item.FindControl("lnkstrLink");
        HiddenField hdnShareInvitee   = (HiddenField)e.Item.FindControl("hdnShareInvitee");

        ViewState["lblGroupName"] = lblGroupName.Text;
        hdnEmailId.Value          = lblEmailId.Text;

        if (e.CommandName == "Details")
        {
            Response.Redirect(lnkstrLink.Text);
        }
        else
        if (e.CommandName == "ShareDetails")
        {
            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect("Group-Home.aspx?GrpId=" + hdnrequserid.Value);
            }
        }
        else
        if (e.CommandName == "Confirm")
        {
            if (hdnTableName.Value == "Scrl_UserRequestInvitationTbl")
            {
                objRegistration.intRequestInvitaionId = Convert.ToInt32(hdnPkId.Value);
                objRegistration.AddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRegistration.IpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRegistration.IpAddress == null)
                {
                    objRegistration.IpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRegistrationDB.AddEditDel_Request(objRegistration, DA_Registrationdetails.RegistrationDetails.Update);
                SendMail(e.CommandName, hdnTableName.Value);
            }

            else if (hdnTableName.Value == "Scrl_UserGroupJoiningTbl")
            {
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDO.intAddedBy       = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.strIpAddress     = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Update);
                SendMail(e.CommandName, hdnTableName.Value);
            }

            else if (hdnTableName.Value == "Scrl_UserRecommendationTbl")
            {
                objRecmndDO.intRecommendationId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy          = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress        = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelRecommendations(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_UserRecommendation.Update);

                SendMail(e.CommandName, hdnTableName.Value);
            }
            else if (hdnTableName.Value == "Scrl_RequestGroupJoin")
            {
                objgrp.intAddedBy = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objgrp.inGroupId  = Convert.ToInt32(hdnShareInvitee.Value);
                DataSet ds = new DataSet();
                ds = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetOtherGroupDetailsByGroupId);

                if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                    else
                    {
                        if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                }

                else if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "R")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;

                            lblSuccess.Text      = "You have already send the group joining request.";
                            lblSuccess.ForeColor = System.Drawing.Color.Red;
                            divSuccess.Style.Add("display", "block");
                            return;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 0;
                        }
                    }
                }

                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.inGroupId        = Convert.ToInt32(hdnShareInvitee.Value);
                objGrpJoinDO.intInvitedUserId = Convert.ToInt32(ds.Tables[0].Rows[0]["intRegistrationId"]);

                string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (ip == null)
                {
                    ip = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDO.strIpAddress      = ip;
                objGrpJoinDO.intAddedBy        = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.intRegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Insert);
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.UpdateGroupMember);
            }

            BindAllRequest();
        }
        else
        if (e.CommandName == "Delete")
        {
            ViewState["hdnTableName"]          = hdnTableName.Value;
            ViewState["intRequestInvitaionId"] = hdnPkId.Value;
            divSuccess.Style.Add("display", "block");
        }
    }
コード例 #4
0
 protected void lvMDAsset_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
 }
コード例 #5
0
    protected void lstProductDetails_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        var    item = e.Item as ListViewDataItem;
        var    cmd  = e.CommandName;
        var    ProductOptionCategoryID   = ""; //(item.FindControl("hdnProductOptionCategoryID") as HiddenField).Value;
        var    ProductOptionCategoryName = ""; //(item.FindControl("hdnProductOptionCategoryName") as HiddenField).Value;
        var    ProductID           = (item.FindControl("hdnProductID") as HiddenField).Value;
        var    ProductName         = (item.FindControl("lblProductName") as Label).Text;
        var    ProductNameEn       = ""; //(item.FindControl("lblProductNameEn") as Label).Text;
        var    ImageName           = (item.FindControl("hdnImageName") as HiddenField).Value;
        var    ProductCode         = ""; //(item.FindControl("hdnProductCode") as HiddenField).Value;
        var    ProductLengthID     = ""; //(item.FindControl("hdnProductLengthID") as HiddenField).Value;
        var    ProductLengthName   = ""; //(item.FindControl("hdnProductLengthName") as HiddenField).Value;
        var    Quantity            = "1";
        double Price               = Convert.ToDouble((item.FindControl("hdnPrice") as HiddenField).Value);
        string ProductSizeColorID1 = "";
        string QuantityList        = "";
        int    SizeColorQuantity1  = 0;
        var    oProductSizeColor   = new ProductSizeColor();
        var    oShoppingCart       = new ShoppingCart();

        if (cmd == "AddToCart")
        {
            //try
            //{
            //    if (ProductID != "")
            //    {

            //        if (oShoppingCart.CartSelectOne(ProductID).DefaultView.Count > 0)
            //        {
            //            //var dv = oProductSizeColor.ProductSizeColorSelectAll(ProductLengthID, ProductOptionCategoryID, ProductID, "True",
            //            //                                                 "True", "", "True").DefaultView;
            //            //ProductSizeColorID1 = dv[0]["ProductSizeColorID"].ToString();
            //            //SizeColorQuantity1 = Convert.ToInt32(dv[0]["Quantity"].ToString()) - Convert.ToInt32(dv[0]["QuantitySale"].ToString());
            //            //for (int i = 1; i <= SizeColorQuantity1; i++)
            //            //{
            //            //    QuantityList = QuantityList + i + ",";
            //            //}
            //            var dv = oShoppingCart.CartSelectOne(ProductID).DefaultView;
            //            int iQuantityAdd = Convert.ToInt32(dv[0]["Quantity"].ToString()) + 1;
            //            oShoppingCart.UpdateQuantity(ProductID, ProductLengthID, ProductOptionCategoryID,
            //                iQuantityAdd.ToString());
            //        }
            //        else
            //        {
            //            oShoppingCart.CreateCart(ProductID,
            //            ImageName,
            //            ProductName,
            //            ProductNameEn,
            //            ProductCode,
            //            ProductOptionCategoryID,
            //            ProductOptionCategoryName,
            //            ProductLengthID,
            //            ProductLengthName,
            //            ProductSizeColorID1,
            //            Quantity,
            //            SizeColorQuantity1.ToString(),
            //            Price,
            //            false
            //            );
            //        }
            //    }

            //}
            //catch (Exception ex)
            //{

            //}

            oShoppingCart.CreateCart(ProductID,
                                     ImageName,
                                     ProductName,
                                     ProductNameEn,
                                     ProductCode,
                                     ProductOptionCategoryID,
                                     ProductOptionCategoryName,
                                     ProductLengthID,
                                     ProductLengthName,
                                     ProductSizeColorID1,
                                     Quantity,
                                     SizeColorQuantity1.ToString(),
                                     Price,
                                     false
                                     );

            //ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "runtime", "myconfirmPopup('" + "<strong>" + ProductName + " - " + ProductCode + " - " + ProductOptionCategoryName + "</strong><br/> đã được thêm vào giỏ hàng" + "')", true);
            Response.Redirect("thong-tin-dat-hang.aspx");
        }
    }
コード例 #6
0
 protected void uoListViewHotelHeader_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     uoHiddenFieldOrder.Value = e.CommandName;
     BindVehicleManifestWithOrder();
 }
コード例 #7
0
        protected void GridView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            // Separate the command arguments
            string[] commandArguments = e.CommandArgument.ToString().Split(Common.separator, StringSplitOptions.None);
            string   fileName         = commandArguments[0];             // File or folder name
            bool     isFolder         = bool.Parse(commandArguments[1]); // is Folder?

            if (e.CommandName == "OpenFolder")
            {
                // If it is a folder
                if (isFolder == true)
                {
                    if (string.CompareOrdinal(fileName, "..") == 0)
                    {
                        var currentFullPath = this.CurrentFolder;
                        if (currentFullPath.EndsWith("\\") || currentFullPath.EndsWith("/"))
                        {
                            currentFullPath = currentFullPath.Substring(0, currentFullPath.Length - 1);
                        }

                        currentFullPath = currentFullPath.Replace("/", "\\");

                        var folders = currentFullPath.Split("\\".ToCharArray());

                        this.CurrentFolder = string.Join("\\", folders, 0, folders.Length - 1);
                    }
                    else
                    {
                        this.CurrentFolder = Path.Combine(this.CurrentFolder, fileName as string);
                    }


                    PopulateFoldersAndFiles();
                }
            }
            else if (e.CommandName == "DownloadFile")
            {
                // Only download the file
                if (isFolder == false)
                {
                    Response.ContentType = ContentType;
                    Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName));
                    Response.WriteFile(fileName);
                    Response.End();
                }
            }
            else if (e.CommandName == "DeleteFile")
            {
                // Handle delete file
                if (isFolder == false && File.Exists(fileName))
                {
                    File.Delete(fileName);
                    //PopulateFoldersAndFiles();
                }
                // Handle delete folder
                else
                {
                    if (Directory.Exists(fileName))
                    {
                        Directory.Delete(fileName, true);
                    }
                }
                // Delete works in thread, sleep for .5 sec, to give it time to delete the files
                // Otherwise, populate method fetches the files, which were just deleted.
                System.Threading.Thread.Sleep(500);
                // Refresh the files and folders list after deleting
                PopulateFoldersAndFiles();
            }
        }
コード例 #8
0
    protected void CenterLView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string c_id = e.CommandArgument.ToString();

        Response.Redirect("Detail.aspx?centerid=" + c_id + "&type=ss");
    }
コード例 #9
0
    protected void SeminarLView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string s_id = e.CommandArgument.ToString();

        Response.Redirect("Detail.aspx?seminarid=" + s_id + "&type=sem");
    }
コード例 #10
0
    protected void ItemLView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string item_id = e.CommandArgument.ToString();

        Response.Redirect("ItemDetail.aspx?itemid=" + item_id);
    }
コード例 #11
0
    protected void JobLView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string j_id = e.CommandArgument.ToString();

        Response.Redirect("Detail.aspx?jobid=" + j_id + "&type=jv");
    }
コード例 #12
0
        public void lvwClasses_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            string commandName = e.CommandName.ToLower();

            if (!commandName.StartsWith("x"))
            {
                return;
            }

            ScheduleBLL scheduleDB = new ScheduleBLL();

            bool dbModified = false;

            string xPath = (string)e.CommandArgument;

            if (commandName.Equals("xdelete"))
            {
                if (scheduleDB.deleteItem(xPath))
                {
                    lvwClasses.DataBind();
                    dbModified = true;
                }
            }
            else
            {
                ClassInfo classInfo = new ClassInfo();

                TextBox     txtStartsDate         = (TextBox)e.Item.FindControl("txtStartsDate");
                HiddenField hidMandatoryDateArray = (HiddenField)e.Item.FindControl("hidMandatoryDateArray");
                TextBox     txtMandatoryDate      = (TextBox)e.Item.FindControl("txtMandatoryDate");
                HiddenField hidSkipDateArray      = (HiddenField)e.Item.FindControl("hidSkipDateArray");
                TextBox     txtSkipDate           = (TextBox)e.Item.FindControl("txtSkipDate");
                TextBox     txtEndsDate           = (TextBox)e.Item.FindControl("txtEndsDate");
                TextBox     txtDays      = (TextBox)e.Item.FindControl("txtDays");
                TextBox     txtTime      = (TextBox)e.Item.FindControl("txtTime");
                TextBox     txtArea      = (TextBox)e.Item.FindControl("txtArea");
                CheckBox    chkFilled    = (CheckBox)e.Item.FindControl("chkFilled");
                CheckBox    chkCancelled = (CheckBox)e.Item.FindControl("chkCancelled");

                classInfo.StartDate = DateTime.Parse(txtStartsDate.Text);
                classInfo.EndDate   = DateTime.Parse(txtEndsDate.Text);
                classInfo.Days      = txtDays.Text;
                classInfo.Time      = txtTime.Text;
                classInfo.Area      = txtArea.Text;
                classInfo.Filled    = chkFilled.Checked;
                classInfo.Cancelled = chkCancelled.Checked;

                // If hidMandatoryDateArray is blank, then only set the MandatoryDate,
                // otherwise set the MandatoryDateArray, which uses the first Date from the array as MandatoryDate
                if (string.IsNullOrEmpty(hidMandatoryDateArray.Value))
                {
                    classInfo.MandatoryDate = (string.IsNullOrEmpty(txtMandatoryDate.Text) ? DateTime.MinValue : DateTime.Parse(txtMandatoryDate.Text));
                }
                else
                {
                    classInfo.MandatoryDateArray = hidMandatoryDateArray.Value;
                }

                // If hidSkipDateArray is blank, then only set the SkipDate,
                // otherwise set the SkipDateArray, which uses the first Date from the array as SkipDate
                if (string.IsNullOrEmpty(hidSkipDateArray.Value))
                {
                    classInfo.SkipDate = (string.IsNullOrEmpty(txtSkipDate.Text) ? DateTime.MinValue : DateTime.Parse(txtSkipDate.Text));
                }
                else
                {
                    classInfo.SkipDateArray = hidSkipDateArray.Value;
                }

                // Update or save the series info based on the command name
                if (commandName.Equals("xupdate"))
                {
                    if (scheduleDB.saveChanges(xPath, classInfo))
                    {
                        lvwClasses.EditIndex = -1;
                        dbModified           = true;
                    }
                }
                else   // xinsert
                {
                    if (scheduleDB.saveNewItem(xPath, classInfo))
                    {
                        lvwClasses.DataBind();
                        dbModified = true;
                    }
                }

                if (dbModified)
                {
                    string strScript = "highLightClass('" + classInfo.ID.ToString() + "');";
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "hlClass", strScript, true);
                }
            }

            displayDbError(dbModified, scheduleDB.Error, commandName);
        }
コード例 #13
0
        public void lvwSchedule_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            string commandName = e.CommandName.ToLower();

            if (!commandName.StartsWith("x"))
            {
                return;
            }

            ScheduleBLL scheduleDB = new ScheduleBLL();

            bool dbModified = false;

            string xPath = (string)e.CommandArgument;

            if (commandName.Equals("xdelete"))
            {
                if (scheduleDB.deleteItem(xPath))
                {
                    lvwSchedule.DataBind();
                    dbModified = true;
                }
            }
            else
            {
                SeriesInfo seriesInfo = new SeriesInfo();

                DropDownList ddlMonth       = (DropDownList)e.Item.FindControl("ddlMonth");
                DropDownList ddlYear        = (DropDownList)e.Item.FindControl("ddlYear");
                TextBox      txtTitle       = (TextBox)e.Item.FindControl("txtTitle");
                CheckBox     chkCustomTitle = (CheckBox)e.Item.FindControl("chkCustomTitle");
                CheckBox     chkVisible     = (CheckBox)e.Item.FindControl("chkVisible");

                // Set the new series information data
                seriesInfo.Date        = new DateTime(int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), 1);
                seriesInfo.Title       = txtTitle.Text;
                seriesInfo.CustomTitle = chkCustomTitle.Checked;
                seriesInfo.Visible     = chkVisible.Checked;

                // Update or save the series info based on the command name
                if (commandName.Equals("xupdate"))
                {
                    if (scheduleDB.saveChanges(xPath, seriesInfo))
                    {
                        lvwSchedule.EditIndex = -1;
                        dbModified            = true;
                    }
                }
                else   // xinsert
                {
                    if (scheduleDB.saveNewItem(seriesInfo))
                    {
                        lvwSchedule.DataBind();
                        dbModified = true;
                    }
                }

                if (dbModified)
                {
                    string strScript = "highLightSeries('" + seriesInfo.Date.ToShortDateString() + "');";
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "hlSeries", strScript, true);
                }
            }

            displayDbError(dbModified, scheduleDB.Error, commandName);
        }
コード例 #14
0
        protected void ConfirmData_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            try
            {
                string       commandName   = e.CommandName;
                object       commandArg    = e.CommandArgument;
                ListViewItem selectedItem  = e.Item;
                int          dataItemIndex = selectedItem.DataItemIndex;
                int          HID           = Convert.ToInt32(commandArg);

                if (commandName == "RentApartment")
                {
                    Session["HID"] = HID;
                    Response.Redirect("~/Models/Member/PropertyRent.aspx");
                }
                else if (commandName == "SellApartment")
                {
                    Session["HID"] = HID;
                    Response.Redirect("~/Models/Member/PropertySell.aspx");
                }
                else if (commandName == "DeleteRent")
                {
                    Label Apartment = (Label)e.Item.FindControl("lblApartmentNo");

                    if (Page.IsValid)
                    {
                        string sql = null;
                        try
                        {
                            SqlConnection cnn = new SqlConnection("Data Source = JARVIS; Initial Catalog = HousingMSdb; User ID = sa; Password = 2411");
                            cnn.Open();

                            sql = "DELETE FROM Rent WHERE HID=@HID; DBCC CHECKIDENT ('Rent', RESEED, 0);";

                            using (SqlCommand cmd = new SqlCommand(sql, cnn))
                            {
                                cmd.Parameters.Add("@HID", SqlDbType.Int).Value = HID;


                                if (cmd.ExecuteNonQuery() == 1)
                                {
                                    string notiftype = "Property Rent Ad";
                                    string notif     = "Apartment " + Apartment.Text + " Rent Ad has been deleted.";
                                    Notification(cnn, notiftype, notif);
                                    Response.Redirect(Request.RawUrl, false);
                                }
                                else
                                {
                                    System.Windows.Forms.MessageBox.Show("Rent could not be deleted, please try again.");
                                }
                            }
                        }
                        catch (System.Data.SqlClient.SqlException sqlException)
                        {
                            System.Windows.Forms.MessageBox.Show("SQL: " + sqlException.Message);
                        }
                    }
                }
                else if (commandName == "DeleteSell")
                {
                    Label Apartment = (Label)e.Item.FindControl("lblApartmentNo");

                    if (Page.IsValid)
                    {
                        string sql = null;
                        try
                        {
                            SqlConnection cnn = new SqlConnection("Data Source = JARVIS; Initial Catalog = HousingMSdb; User ID = sa; Password = 2411");
                            cnn.Open();

                            sql = "DELETE FROM Sell WHERE HID=@HID; DBCC CHECKIDENT ('Sell', RESEED, 0);";

                            using (SqlCommand cmd = new SqlCommand(sql, cnn))
                            {
                                cmd.Parameters.Add("@HID", SqlDbType.Int).Value = HID;

                                if (cmd.ExecuteNonQuery() == 1)
                                {
                                    string notiftype = "Property Sale Ad";
                                    string notif     = "Apartment " + Apartment.Text + " Sale Ad has been deleted.";
                                    Notification(cnn, notiftype, notif);
                                    Response.Redirect(Request.RawUrl, false);
                                }
                                else
                                {
                                    System.Windows.Forms.MessageBox.Show("Sale could not be deleted, please try again.");
                                }
                            }
                        }
                        catch (System.Data.SqlClient.SqlException sqlException)
                        {
                            System.Windows.Forms.MessageBox.Show("SQL: " + sqlException.Message);
                        }
                    }
                }
                else if (commandName == "Images")
                {
                }
            }
            catch (FormatException)
            {
                System.Windows.Forms.MessageBox.Show("Please enter the price.");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
コード例 #15
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Guid post_id = Guid.Empty; String like_Id = ""; String post_userId = "";
        Guid currentUserId = Guid.Empty; String user_Id = "";

        try
        {
            like_Id     = ListView1.DataKeys[e.Item.DataItemIndex].Values[1].ToString();
            post_userId = ListView1.DataKeys[e.Item.DataItemIndex].Values[2].ToString();
            MembershipUser currentUser = Membership.GetUser();
            post_id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            currentUserId = (Guid)currentUser.ProviderUserKey;
            user_Id       = currentUserId.ToString();
        }
        catch { }
        if (String.Equals(e.CommandName, "allcomment"))
        {
            //Panel cp=  ListView1.FindControl("PanelPostComment") as Panel;
            //string cpanel = cp.ClientID;
            postId = post_id;
            //PostCommentDataSource.SelectCommand = "SELECT * FROM [UserComments] WHERE ([PostId] = @PostId) ORDER BY [CommentDate]";
            //PostCommentDataSource.SelectParameters.Clear();
            //PostCommentDataSource.SelectParameters.Add("PostId", post_id.ToString());
            PostCommentDataSource.DataBind();
            //return;
        }

        if (String.Equals(e.CommandName, "LikeButton"))
        {
            //ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            //Guid code = (Guid)ListView1.DataKeys[dataItem.DisplayIndex].Value;
            likeId_in = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[1];

            //if (String.Equals(lbtn.Text , "Like"))
            //{

            ImageButton lb = e.Item.FindControl("LinkButtonLike") as ImageButton;
            LinkButton  lbviewallcomment = e.Item.FindControl("LinkViewAllComment") as LinkButton;

            System.Data.SqlClient.SqlDataReader rdr    = null;
            System.Data.SqlClient.SqlConnection conn   = null;
            System.Data.SqlClient.SqlCommand    sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [UserLikes]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid = rdr["UserId"].ToString();
                    String lkid  = rdr["LikeId"].ToString();
                    if (user_Id == usrid && like_Id == lkid)
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [UserLikes] WHERE LikeId=@LikeId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@LikeId", new Guid(like_Id));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(user_Id));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString11 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                string insertSql = "INSERT INTO UserLikes(LikeId,LikeUser,UserId) VALUES(@LikeId,@LikeUser,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString11))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
                    myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                    myCommand.Parameters.AddWithValue("@LikeUser", HttpContext.Current.Session["user"]);
                    myCommand.Parameters.AddWithValue("@UserId", user_Id);
                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
                string connectionString5 = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [Notifications]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid  = rdr["UserId"].ToString();
                    String lkid   = rdr["LikeId"].ToString();
                    String notify = rdr["NotifyTo"].ToString();
                    if (user_Id == usrid && like_Id == lkid && notify == post_userId)
                    {
                        return;
                    }
                }

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


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

                    using (SqlConnection myConnection = new SqlConnection(connectionString12))
                    {
                        myConnection.Open();
                        SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);
                        myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                        myCommand.Parameters.AddWithValue("@Type", "Post_Like");
                        myCommand.Parameters.AddWithValue("@UserId", user_Id);
                        myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);
                        ListView lstview  = sender as ListView;
                        Guid     post__id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];
                        myCommand.Parameters.AddWithValue("@PostId", post__id);

                        myCommand.ExecuteNonQuery();
                        myConnection.Close();
                    }
                }
                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }
        }

        if (String.Equals(e.CommandName, "SharePostId"))
        {
            sharepostId = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            //((AjaxControlToolkit.ModalPopupExtender)(ListView1.FindControl("MPEShare"))).Show();
            //MPEShare.Show();
        }
        if (String.Equals(e.CommandName, "Updatepost"))
        {
            Label lbl = ListView1.EditItem.FindControl("PostIdLabel") as Label;
            if (lbl != null)
            {
                postId_edit = new Guid(lbl.Text);
            }

            TextBox txt       = ListView1.EditItem.FindControl("PostTextBox") as TextBox;
            String  edit_text = txt.Text;



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string updateSql = "UPDATE [UserPosts] SET [Post] = @Post WHERE [PostId] = @PostId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
                myCommand.Parameters.AddWithValue("@Post", edit_text);
                myCommand.Parameters.AddWithValue("@PostId", postId_edit);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
            ListView1.EditIndex = -1;
            Button btnCancel = (ListView1.Items[e.Item.DataItemIndex].FindControl("CancelButton")) as Button;
            //Button btnCancel=   ListView1.EditItem.FindControl("CancelButton") as Button;
            //CancelButton_Click(btnCancel, EventArgs.Empty);
            //btnCancel.Visible = true;
            //Type t = typeof(Button);
            //object[] p = new object[1];
            //p[0] = EventArgs.Empty;
            //MethodInfo m = t.GetMethod("OnClick", BindingFlags.NonPublic | BindingFlags.Instance);
            //m.Invoke(btnCancel, p);

            ListView1.DataBind();
        }
        if (String.Equals(e.CommandName, "Deletepost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string Sql = "delete from [UserPosts] WHERE [PostId]=@PostId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                myCommand.Parameters.AddWithValue("@PostId", post_Id);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



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

            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        ListView1.DataBind();
    }
コード例 #16
0
    protected void ExhibitionLView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string ex_id = e.CommandArgument.ToString();

        Response.Redirect("Detail.aspx?ewid=" + ex_id + "&type=expo");
    }
コード例 #17
0
        protected void LVPatientDetailDetails_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "EditData")
            {
                //PageReset();
                Label lblPHCID       = (Label)e.Item.FindControl("lblPHCID");
                Label lblPatientID   = (Label)e.Item.FindControl("lblPatientID");
                Label lblPatientName = (Label)e.Item.FindControl("lblPatientName");
                Label lblECNumber    = (Label)e.Item.FindControl("lblECNumber");
                Label lblBloodGroup  = (Label)e.Item.FindControl("lblBloodGroup");
                Label lblGender      = (Label)e.Item.FindControl("lblGender");
                Label lblAge         = (Label)e.Item.FindControl("lblAge");
                Label lblDOB         = (Label)e.Item.FindControl("lblDOB");
                Label lblPlace       = (Label)e.Item.FindControl("lblPlace");
                Label lblContactNo   = (Label)e.Item.FindControl("lblContactNo");
                Label lblRefPhoneNo  = (Label)e.Item.FindControl("lblRefPhoneNo");
                Label lblAddress     = (Label)e.Item.FindControl("lblAddress");
                Label lblVillageID   = (Label)e.Item.FindControl("lblVillageID");

                Label  lblEducationID = (Label)e.Item.FindControl("lblEducationID");
                Label  lblReligionID  = (Label)e.Item.FindControl("lblReligionID");
                Label  lblIsMarried   = (Label)e.Item.FindControl("lblIsMarried");
                Label  lblHusbandName = (Label)e.Item.FindControl("lblHusbandName");
                Label  lblFatherName  = (Label)e.Item.FindControl("lblFatherName");
                string PatientID      = lblPatientID.Text;
                btnSave.Visible     = false;
                btnUpdate.Visible   = true;
                txtPatientName.Text = lblPatientName.Text;
                txtECNo.Text        = lblECNumber.Text;
                if (!string.IsNullOrEmpty(txtECNo.Text))
                {
                    ViewState[VSECNo] = txtECNo.Text;
                }
                else
                {
                    ViewState[VSECNo] = null;
                }

                ddlBloodGroup.SelectedValue = lblBloodGroup.Text;
                if (lblGender.Text == PHCConstant.Male)
                {
                    rbMale.Checked = true;
                }
                else
                {
                    rbFemale.Checked = true;
                }

                if (lblIsMarried.Text == PHCConstant.Married)
                {
                    rbMale.Checked = true;
                }
                else if (lblIsMarried.Text == PHCConstant.Single)
                {
                    rbUnmarried.Checked = true;
                }

                txtHusbandName.Text = lblHusbandName.Text;
                txtFatherName.Text  = lblFatherName.Text;
                txtAge.Text         = lblAge.Text;
                txtDOB.Text         = lblDOB.Text;
                BindVillages();
                ddlVillages.SelectedValue = lblVillageID.Text;

                BindReligion();
                ddlReligion.SelectedValue = lblReligionID.Text;
                BindEducation();
                ddlEducation.SelectedValue = lblEducationID.Text;

                txtAddress.Text = lblAddress.Text;

                txtContactNo.Text      = lblContactNo.Text;
                txtPhoneNo.Text        = lblRefPhoneNo.Text;
                ViewState[VSPatientID] = PatientID;
            }
        }
コード例 #18
0
        protected void lvBDProjectCollectedDocumentCategoryInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ProjectCollectedDocumentCategoryInfoID;

            Int64.TryParse(e.CommandArgument.ToString(), out ProjectCollectedDocumentCategoryInfoID);

            if (ProjectCollectedDocumentCategoryInfoID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ProjectCollectedDocumentCategoryInfoID = ProjectCollectedDocumentCategoryInfoID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentCategoryInfoEntity.FLD_NAME_ProjectCollectedDocumentCategoryInfoID, ProjectCollectedDocumentCategoryInfoID.ToString(), SQLMatchType.Equal);

                        BDProjectCollectedDocumentCategoryInfoEntity bDProjectCollectedDocumentCategoryInfoEntity = new BDProjectCollectedDocumentCategoryInfoEntity();


                        result = FCCBDProjectCollectedDocumentCategoryInfo.GetFacadeCreate().Delete(bDProjectCollectedDocumentCategoryInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ProjectCollectedDocumentCategoryInfoID       = 0;
                            _BDProjectCollectedDocumentCategoryInfoEntity = new BDProjectCollectedDocumentCategoryInfoEntity();
                            PrepareInitialView();
                            BindBDProjectCollectedDocumentCategoryInfoList();

                            MiscUtil.ShowMessage(lblMessage, "Project Collected Document Category Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Collected Document Category Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #19
0
        protected void lvPRMWorkOrder_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkOrderID;

            Int64.TryParse(e.CommandArgument.ToString(), out WorkOrderID);

            if (WorkOrderID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    String url = UrlHelper.BuildSecureUrl("~/PRM/PRMWorkOrder.aspx", string.Empty, UrlConstants.OVERVIEW_WORKORDER_ID, WorkOrderID.ToString()).ToString();
                    Response.Redirect(url);
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        PRMWorkOrderEntity pRMWorkOrderEntity = new PRMWorkOrderEntity();


                        result = FCCPRMWorkOrder.GetFacadeCreate().Delete(pRMWorkOrderEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _WorkOrderID        = 0;
                            _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                            PrepareInitialView();
                            BindPRMWorkOrderList();

                            MiscUtil.ShowMessage(lblMessage, "Work Order has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "UpdateItem"))
                {
                    try
                    {
                        #region Approval Process

                        Boolean apResult = APRobot.ResetApprovalProcessForWorkOrder(WorkOrderID);

                        if (apResult == true)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Approval Process has been reset successfully.", UIConstants.MessageType.GREEN);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to reset approval process.", UIConstants.MessageType.RED);
                        }

                        // EnableDisableApprovalProcessCheck();

                        BindList();

                        #endregion

                        //Int64 result = -1;

                        //String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        //PRMWorkOrderEntity pRMWorkOrderEntity = new PRMWorkOrderEntity();


                        //result = FCCPRMWorkOrder.GetFacadeCreate().Delete(pRMWorkOrderEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        //if (result == 0)
                        //{
                        //    _WorkOrderID = 0;
                        //    _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                        //    PrepareInitialView();
                        //    BindPRMWorkOrderList();

                        //    MiscUtil.ShowMessage(lblMessage, "Work Order has been successfully deleted.", true);
                        //}
                        //else
                        //{
                        //    MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order.", true);
                        //}
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #20
0
 protected void uoListViewDashboard_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
 }
 protected void RevListView_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
 }
コード例 #22
0
        //protected void AuctionGridView_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    GridViewRow row = AuctionGridView.Rows[AuctionGridView.SelectedIndex];
        //    Session["Auction"] = row.Cells[3].Text;
        //    Response.Redirect("Auction.aspx");
        //}

        protected void SelectAuctionBtn_Click(object sender, ListViewCommandEventArgs e)
        {
            Session["Auction"] = e.CommandArgument;
            Response.Redirect("Auction.aspx");
        }
コード例 #23
0
        protected void lvPRMMaterialReceiveItemMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 MaterialReceiveItemMapID;

            Int64.TryParse(e.CommandArgument.ToString(), out MaterialReceiveItemMapID);

            if (e.CommandName == "FloorWiseRateAndQty")
            {
                CurrentWorkOrderItemIDPopup = MaterialReceiveItemMapID;

                Label lblItemLV               = (Label)e.Item.FindControl("lblItemLV");
                Label lblRequisitionIDLV      = (Label)e.Item.FindControl("lblRequisitionIDLV");
                Label lblRequisitionItemIDLV  = (Label)e.Item.FindControl("lblRequisitionItemIDLV");
                Label lblWorkOrderItemMapIDLV = (Label)e.Item.FindControl("lblWorkOrderItemMapIDLV");

                Label lblProjectIDLV   = (Label)e.Item.FindControl("lblProjectIDLV");
                Label lblWorkOrderIDLV = (Label)e.Item.FindControl("lblWorkOrderIDLV");

                Int64 itemID;
                Int64.TryParse(lblItemLV.Text.Trim(), out itemID);

                String fe_floor = SqlExpressionBuilder.PrepareFilterExpression(BDProjectFloorEntity.FLD_NAME_ProjectID, lblProjectIDLV.Text.ToString(), SQLMatchType.Equal);
                IList <BDProjectFloorEntity> lstBDProjectFloor = FCCBDProjectFloor.GetFacadeCreate().GetIL(null, null, String.Empty, fe_floor, DatabaseOperationType.LoadWithFilterExpression);

                if (lstBDProjectFloor != null && lstBDProjectFloor.Count > 0)
                {
                    String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQEntity.FLD_NAME_ProjectID, lblProjectIDLV.Text.ToString(), SQLMatchType.Equal);
                    IList <PRMPreBOQEntity> preBOQList = FCCPRMPreBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    if (preBOQList != null && preBOQList.Count > 0)
                    {
                        Int64 preBOQID = preBOQList[0].PreBOQID;

                        switch (preBOQList[0].IsLocked)
                        {
                        case true:

                            #region GET Item From BOQ

                            String fe_boq = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal);
                            IList <PRMBOQEntity> lstPRMBOQ = FCCPRMBOQ.GetFacadeCreate().GetIL(null, null, String.Empty, fe_boq, DatabaseOperationType.LoadWithFilterExpression);

                            if (lstPRMBOQ != null && lstPRMBOQ.Count > 0)
                            {
                                String fe_BOQDetail1 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetailEntity.FLD_NAME_BOQID, lstPRMBOQ[0].BOQID.ToString(), SQLMatchType.Equal);
                                String fe_BOQDetail2 = SqlExpressionBuilder.PrepareFilterExpression(PRMBOQDetailEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);

                                String fe_BOQDetail = SqlExpressionBuilder.PrepareFilterExpression(fe_BOQDetail1, SQLJoinType.AND, fe_BOQDetail2);

                                IList <PRMBOQDetailEntity> lstPRMBOQDetail = FCCPRMBOQDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_BOQDetail, DatabaseOperationType.LoadWithFilterExpression);

                                if (lstPRMBOQDetail != null && lstPRMBOQDetail.Count > 0)
                                {
                                    String fe_floorDetail = SqlExpressionBuilder.PrepareFilterExpression("PRMBOQFloorDetail." + PRMBOQFloorDetailEntity.FLD_NAME_BOQDetailID, lstPRMBOQDetail[0].BOQDetailID.ToString(), SQLMatchType.Equal);
                                    IList <PRMBOQFloorDetail_DetailedEntity> lstPRMPreBOQFloorDetail = FCCPRMBOQFloorDetail_Detailed.GetFacadeCreate().GetIL(100000, 1, String.Empty, fe_floorDetail);

                                    lvREQRequisitionItemFloorDetail.DataSource = lstPRMPreBOQFloorDetail;
                                    lvREQRequisitionItemFloorDetail.DataBind();
                                }
                            }

                            #endregion

                            break;

                        case false:

                            #region Get Item From Pre-BOQ

                            String fe_preBOQDetail1 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_PreBOQID, preBOQID.ToString(), SQLMatchType.Equal);
                            String fe_preBOQDetail2 = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQDetailEntity.FLD_NAME_ItemID, itemID.ToString(), SQLMatchType.Equal);

                            String fe_preBOQDetail = SqlExpressionBuilder.PrepareFilterExpression(fe_preBOQDetail1, SQLJoinType.AND, fe_preBOQDetail2);

                            IList <PRMPreBOQDetailEntity> lstPRMPreBOQDetail = FCCPRMPreBOQDetail.GetFacadeCreate().GetIL(null, null, String.Empty, fe_preBOQDetail, DatabaseOperationType.LoadWithFilterExpression);

                            if (lstPRMPreBOQDetail != null && lstPRMPreBOQDetail.Count > 0)
                            {
                                String fe_floorDetail = SqlExpressionBuilder.PrepareFilterExpression("PRMPreBOQFloorDetail." + PRMPreBOQFloorDetailEntity.FLD_NAME_PreBOQDetailID, lstPRMPreBOQDetail[0].PreBOQDetailID.ToString(), SQLMatchType.Equal);
                                IList <PRMPreBOQFloorDetail_DetailedEntity> lstPRMPreBOQFloorDetail = FCCPRMPreBOQFloorDetail_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_floorDetail);

                                lvREQRequisitionItemFloorDetail.DataSource = lstPRMPreBOQFloorDetail;
                                lvREQRequisitionItemFloorDetail.DataBind();
                            }

                            #endregion

                            break;

                        default:
                            break;
                        }
                    }
                }

                Label lblItemNameLV = (Label)e.Item.FindControl("lblItemNameLV");

                //BindREQRequisitionFloorDetailList();
                //lblFloorWiseItemName.Text = lblItemNameLV.Text.ToString();
                this.ModalPopupExtender2.Show();

                if (lvREQRequisitionItemFloorDetail.DataSource != null)
                {
                    btnFloorPopupSave.Enabled = true;
                }
                else
                {
                    btnFloorPopupSave.Enabled = false;
                }

                if (CurrentPRMWorkOrderEntity.WorkOrderStatusID != MasterDataConstants.WorkOrderStatus.APPROVED)
                {
                    lblLockMessage.Visible = false;
                }

                else if (CurrentPRMWorkOrderEntity.WorkOrderStatusID == MasterDataConstants.WorkOrderStatus.APPROVED)
                {
                    btnFloorPopupSave.Enabled = false;
                    lblLockMessage.Visible    = true;
                }
            }

            if (MaterialReceiveItemMapID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _MaterialReceiveItemMapID = MaterialReceiveItemMapID;
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMMaterialReceiveItemMapEntity.FLD_NAME_MaterialReceiveItemMapID, MaterialReceiveItemMapID.ToString(), SQLMatchType.Equal);

                        PRMMaterialReceiveItemMapEntity pRMMaterialReceiveItemMapEntity = new PRMMaterialReceiveItemMapEntity();


                        result = FCCPRMMaterialReceiveItemMap.GetFacadeCreate().Delete(pRMMaterialReceiveItemMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _MaterialReceiveItemMapID        = 0;
                            _PRMMaterialReceiveItemMapEntity = new PRMMaterialReceiveItemMapEntity();
                            PrepareInitialView();
                            BindPRMMaterialReceiveItemMapList();

                            MiscUtil.ShowMessage(lblMessage, "Material Receive Item Map has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Material Receive Item Map.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #24
0
 protected void lvStudents_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
 }
コード例 #25
0
 /// <summary>
 /// Toggle time series for water
 /// </summary>
 protected void OnItemCommandWATER(object sender, ListViewCommandEventArgs e)
 {
     onItemCommand(sender, e, MediumFilter.Medium.Water);
 }
コード例 #26
0
 protected void uoListViewVehicleHeader_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     uoHiddenFieldOrder.Value = e.CommandName;
     //BindVehicleManifestWithOrder();
     //uoListviewVehicleInfoPager.SetPageProperties(0, uoListviewVehicleInfoPager.PageSize, false);
 }
コード例 #27
0
        protected void ManageOrg_ListView_OnItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "Update")
            {
                // Find Controls in ListView
                var txt_OrgName                   = (TextBox)e.Item.FindControl("txt_OrgName");
                var txt_OrgAddress                = (TextBox)e.Item.FindControl("txt_OrgAddress");
                var txt_OrgCity                   = (TextBox)e.Item.FindControl("txt_OrgCity");
                var txt_OrgState                  = (TextBox)e.Item.FindControl("txt_OrgState");
                var txt_OrgZip                    = (TextBox)e.Item.FindControl("txt_OrgZip");
                var txt_OrgPhone                  = (TextBox)e.Item.FindControl("txt_OrgPhone");
                var txt_OrgPhone2                 = (TextBox)e.Item.FindControl("txt_OrgPhone2");
                var txt_OrgFax                    = (TextBox)e.Item.FindControl("txt_OrgFax");
                var txt_OrgEmail                  = (TextBox)e.Item.FindControl("txt_OrgEmail");
                var txt_OrgContact                = (TextBox)e.Item.FindControl("txt_OrgContact");
                var txt_OrgDescription            = (TextBox)e.Item.FindControl("txt_OrgDescription");
                var chk_toggleapproveConversation = (CheckBox)e.Item.FindControl("chk_toggleapproveConversation");
                var chk_toggleapproveComment      = (CheckBox)e.Item.FindControl("chk_toggleapproveComment");
                var chk_toggleconversationEmail   = (CheckBox)e.Item.FindControl("chk_toggleconversationEmail");
                var chk_togglecommentEmail        = (CheckBox)e.Item.FindControl("chk_togglecommentEmail");
                var chk_toggleprofanityFilter     = (CheckBox)e.Item.FindControl("chk_toggleprofanityFilter");
                var chk_toggledisableOrg          = (CheckBox)e.Item.FindControl("chk_toggledisableOrg");

                // Set Update Parameters
                SqlDataSource_ManageOrg.UpdateParameters["OrgID"].DefaultValue          = ddl_selectOrg.SelectedValue;
                SqlDataSource_ManageOrg.UpdateParameters["OrgName"].DefaultValue        = txt_OrgName.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgAddress"].DefaultValue     = txt_OrgAddress.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgCity"].DefaultValue        = txt_OrgCity.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgState"].DefaultValue       = txt_OrgState.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgZip"].DefaultValue         = txt_OrgZip.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgPhone"].DefaultValue       = txt_OrgPhone.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgPhone2"].DefaultValue      = txt_OrgPhone2.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgFax"].DefaultValue         = txt_OrgFax.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgEmail"].DefaultValue       = txt_OrgEmail.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgContact"].DefaultValue     = txt_OrgContact.Text;
                SqlDataSource_ManageOrg.UpdateParameters["OrgDescription"].DefaultValue = txt_OrgDescription.Text;

                if (chk_toggleapproveConversation.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["autoApproveConversation"].DefaultValue = "1";
                }

                if (chk_toggleapproveComment.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["autoApproveComment"].DefaultValue = "1";
                }

                if (chk_toggleconversationEmail.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["conversationEmail"].DefaultValue = "1";
                }

                if (chk_togglecommentEmail.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["commentEmail"].DefaultValue = "1";
                }

                if (chk_toggleprofanityFilter.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["profanityFilter"].DefaultValue = "1";
                }

                if (chk_toggledisableOrg.Checked)
                {
                    SqlDataSource_ManageOrg.UpdateParameters["OrgEnabled"].DefaultValue = "0";
                }
            }
        }
コード例 #28
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        if (String.Equals(e.CommandName, "LikeButton"))
        {
            //ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            //Guid code = (Guid)ListView1.DataKeys[dataItem.DisplayIndex].Value;

            String         like_Id     = ListView1.DataKeys[e.Item.DataItemIndex].Values[1].ToString();
            MembershipUser currentUser = Membership.GetUser();

            Guid   currentUserId = (Guid)currentUser.ProviderUserKey;
            String user_Id       = currentUserId.ToString();
            String post_userId   = ListView1.DataKeys[e.Item.DataItemIndex].Values[2].ToString();
            //if (String.Equals(lbtn.Text , "Like"))
            //{

            ImageButton lb = e.Item.FindControl("LinkButtonLike") as ImageButton;
            LinkButton  lbviewallcomment = e.Item.FindControl("LinkViewAllComment") as LinkButton;

            System.Data.SqlClient.SqlDataReader rdr    = null;
            System.Data.SqlClient.SqlConnection conn   = null;
            System.Data.SqlClient.SqlCommand    sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [UserLikes]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid = rdr["UserId"].ToString();
                    String lkid  = rdr["LikeId"].ToString();
                    if (user_Id == usrid && like_Id == lkid)
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [UserLikes] WHERE LikeId=@LikeId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@LikeId", new Guid(like_Id));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(user_Id));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString11 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                string insertSql = "INSERT INTO UserLikes(LikeId,LikeUser,UserId) VALUES(@LikeId,@LikeUser,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString11))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
                    myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                    myCommand.Parameters.AddWithValue("@LikeUser", HttpContext.Current.Session["user"]);



                    myCommand.Parameters.AddWithValue("@UserId", user_Id);



                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
                string connectionString5 = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [Notifications]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid  = rdr["UserId"].ToString();
                    String lkid   = rdr["LikeId"].ToString();
                    String notify = rdr["NotifyTo"].ToString();
                    if (user_Id == usrid && like_Id == lkid && notify == post_userId)
                    {
                        return;
                    }
                }

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


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

                    using (SqlConnection myConnection = new SqlConnection(connectionString12))
                    {
                        myConnection.Open();
                        SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);
                        myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                        myCommand.Parameters.AddWithValue("@Type", "Covert_Post_Like");
                        myCommand.Parameters.AddWithValue("@UserId", user_Id);
                        myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);
                        ListView lstview  = sender as ListView;
                        Guid     post__id = (Guid)lstview.DataKeys[e.Item.DataItemIndex].Values[0];
                        myCommand.Parameters.AddWithValue("@PostId", post__id);
                        myCommand.ExecuteNonQuery();
                        myConnection.Close();
                    }
                }
                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }
        }
        if (String.Equals(e.CommandName, "Updatepost"))
        {
            Label lbl = ListView1.EditItem.FindControl("CovertIdLabel") as Label;
            if (lbl != null)
            {
                postId_edit = new Guid(lbl.Text);
            }

            TextBox txt       = ListView1.EditItem.FindControl("CovertPostTextBox") as TextBox;
            String  edit_text = txt.Text;

            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string updateSql = "UPDATE [CovertPosts] SET [CovertPost] = @CovertPost WHERE [CovertId] = @CovertId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
                myCommand.Parameters.AddWithValue("@CovertPost", edit_text);
                myCommand.Parameters.AddWithValue("@CovertId", postId_edit);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);



                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
            ListView1.EditIndex = -1;
            //Button btnCancel = (ListView1.Items[e.Item.DataItemIndex].FindControl("CancelButton")) as Button;


            ListView1.DataBind();
        }
        if (String.Equals(e.CommandName, "Deletepost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];



            string connectionString =
                ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
            string Sql = "delete from [CovertPosts] WHERE [CovertId]=@CovertId and UserId=@UserId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
            {
                myConnection.Open();
                SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                myCommand.Parameters.AddWithValue("@CovertId", post_Id);
                myCommand.Parameters.AddWithValue("@UserId", currentUserId);

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

            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        if (String.Equals(e.CommandName, "Bookmarkpost"))
        {
            Guid post_Id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];

            System.Data.SqlClient.SqlDataReader rdr = null; System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [CovertBookmark]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String covertid = rdr["CovertId"].ToString();
                    String userid   = rdr["UserId"].ToString();
                    if (covertid == post_Id.ToString() && userid == currentUserId.ToString())
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [CovertBookmark] WHERE CovertId=@CovertId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@CovertId", new Guid(covertid));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(userid));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString2 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                string Sql2 = "INSERT INTO CovertBookmark(CovertId,UserId) VALUES(@CovertId,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString2))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(Sql2, myConnection);
                    myCommand.Parameters.AddWithValue("@CovertId", post_Id);
                    myCommand.Parameters.AddWithValue("@UserId", currentUserId);

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


                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }



            //ListView2.DataBind();
            //UpdatePanel1.Update();
        }
        this.DataBind();
    }
コード例 #29
0
        protected void ShoppingCartList_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "remove")
            {
                string username = User.Identity.Name;
                int    itemid   = int.Parse(e.CommandArgument.ToString());
                int    employeeid;

                if (ShoppingCartList.Items.Count == 0)
                {
                    MessageUserControl.ShowInfo("Warning", "You have clear the shopping cart.");
                }
                else
                {
                    MessageUserControl.TryRun(() =>
                    {
                        ApplicationUserManager secmgr = new ApplicationUserManager(new UserStore <ApplicationUser>(new ApplicationDbContext()));
                        EmployeeInfo info             = secmgr.User_GetEmployee(username);
                        employeeid = info.EmployeeID;
                        ShoppingCartItemController sysmgr = new ShoppingCartItemController();
                        sysmgr.DeleteShoppingItems(employeeid, itemid);

                        List <UserShoppingCartItem> infos = sysmgr.List_ItemsForShoppingCart(employeeid);
                        ShoppingCartList.DataSource       = infos;
                        notificationIcon.Value            = infos.Count.ToString();
                        ShoppingCartList.DataBind();
                        totalLabel.DataBind();

                        refresh_totallabel();
                    }, "Removed", $"Item(s) {itemid} have been removed");
                }
            }
            else if (e.CommandName == "refresh")
            {
                string username = User.Identity.Name;
                int    itemid   = int.Parse(e.CommandArgument.ToString());
                int    employeeid;
                int    quantity = int.Parse((e.Item.FindControl("QuantityLabel") as TextBox).Text);

                MessageUserControl.TryRun(() =>
                {
                    ApplicationUserManager secmgr = new ApplicationUserManager(new UserStore <ApplicationUser>(new ApplicationDbContext()));
                    EmployeeInfo info             = secmgr.User_GetEmployee(username);
                    employeeid = info.EmployeeID;
                    ShoppingCartItemController sysmgr = new ShoppingCartItemController();
                    sysmgr.Update_RefreshCart(employeeid, itemid, quantity);

                    List <UserShoppingCartItem> infos = sysmgr.List_ItemsForShoppingCart(employeeid);
                    ShoppingCartList.DataSource       = infos;
                    notificationIcon.Value            = infos.Count.ToString();
                    ShoppingCartList.DataBind();
                    totalLabel.DataBind();

                    refresh_totallabel();
                }, "Updated", $"Item(s) {itemid} have been updated");
            }
            else
            {
                MessageUserControl.ShowInfo("Glad you found this error, cauz I don't even know what should I call this error.");
            }
        }
コード例 #30
0
    protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        if (String.Equals(e.CommandName, "LikeButtonComment"))
        {
            //Button lbtn = e.Item.FindControl("LinkButtonLike") as Button;

            Label  likeidlbl = e.Item.FindControl("LikeIdLabel") as Label;
            String like_Id   = likeidlbl.Text;

            MembershipUser currentUser = Membership.GetUser();

            Guid   currentUserId = (Guid)currentUser.ProviderUserKey;
            String user_Id       = currentUserId.ToString();
            string post_userId   = e.CommandArgument.ToString();

            ImageButton lb = e.Item.FindControl("LinkButtonLike") as ImageButton;
            LinkButton  lbviewallcomment = e.Item.FindControl("LinkViewAllComment") as LinkButton;

            System.Data.SqlClient.SqlDataReader rdr    = null;
            System.Data.SqlClient.SqlConnection conn   = null;
            System.Data.SqlClient.SqlCommand    sqlcmd = null;

            try
            {
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [UserLikes]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid = rdr["UserId"].ToString();
                    String lkid  = rdr["LikeId"].ToString();
                    if (user_Id == usrid && like_Id == lkid)
                    {
                        string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                        //string selectSql = "SELECT * FROM UserLikes WHERE UserId = @UserId";
                        string Sql = "delete from [UserLikes] WHERE LikeId=@LikeId and UserId=@UserId";

                        using (SqlConnection myConnection = new SqlConnection(connectionString10))
                        {
                            myConnection.Open();
                            SqlCommand myCommand = new SqlCommand(Sql, myConnection);
                            myCommand.Parameters.AddWithValue("@LikeId", new Guid(like_Id));
                            myCommand.Parameters.AddWithValue("@UserId", new Guid(user_Id));

                            myCommand.ExecuteNonQuery();

                            myConnection.Close();
                        }
                        return;
                        //rdr.NextResult();
                    }
                }
                string connectionString11 =
                    ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


                string insertSql = "INSERT INTO UserLikes(LikeId,LikeUser,UserId) VALUES(@LikeId,@LikeUser,@UserId)";

                using (SqlConnection myConnection = new SqlConnection(connectionString11))
                {
                    myConnection.Open();
                    SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
                    myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                    myCommand.Parameters.AddWithValue("@LikeUser", HttpContext.Current.Session["user"]);



                    myCommand.Parameters.AddWithValue("@UserId", user_Id);



                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                }
                string connectionString5 = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;
                conn = new System.Data.SqlClient.SqlConnection(connectionString);

                sqlcmd = new System.Data.SqlClient.SqlCommand("select * from [Notifications]", conn);
                conn.Open();

                rdr = sqlcmd.ExecuteReader();

                //if (rdr.HasRows)
                //{
                while (rdr.Read())
                {
                    String usrid  = rdr["UserId"].ToString();
                    String lkid   = rdr["LikeId"].ToString();
                    String notify = rdr["NotifyTo"].ToString();
                    if (user_Id == usrid && like_Id == lkid && notify == post_userId)
                    {
                        return;
                    }
                }
                if (user_Id != post_userId)
                {
                    string connectionString12 =
                        ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString;


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

                    using (SqlConnection myConnection = new SqlConnection(connectionString12))
                    {
                        myConnection.Open();
                        SqlCommand myCommand = new SqlCommand(insertSql2, myConnection);
                        myCommand.Parameters.AddWithValue("@LikeId", like_Id);
                        myCommand.Parameters.AddWithValue("@Type", "Covert_Comment_Like");
                        myCommand.Parameters.AddWithValue("@UserId", user_Id);
                        myCommand.Parameters.AddWithValue("@NotifyTo", post_userId);
                        ListView lstview = sender as ListView;

                        Guid post__id = (Guid)ListView1.DataKeys[e.Item.DataItemIndex].Values[0];
                        myCommand.Parameters.AddWithValue("@PostId", post__id);
                        myCommand.ExecuteNonQuery();
                        myConnection.Close();
                    }
                }

                if (rdr != null)
                {
                    rdr.Close();
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                this.DataBind();
            }
        }
    }
コード例 #31
0
ファイル: ListView.cs プロジェクト: bnantz/NCS-V1-1
 protected virtual void OnItemCommand(ListViewCommandEventArgs e)
 {
     ListViewCommandEventHandler handler = (ListViewCommandEventHandler)Events[EventItemCommand];
     if (handler != null) {
         handler(this, null);
     }
 }
コード例 #32
0
 protected void lvACCPrePayableStatementDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
 }