protected void Button5_Click(object sender, EventArgs e)
 {
     SqlDataSourceChain.Delete();
     for (int i = 0; i < GridView3.Rows.Count; i++)
     {
         TableCell TableCell1 = (TableCell)GridView3.Rows[i].Cells[0];
         CheckBox  CheckBox1  = (CheckBox)TableCell1.FindControl("CheckBox1");
         if (!CheckBox1.Checked)
         {
             continue;
         }
         HiddenField HiddenField2 = (HiddenField)TableCell1.FindControl("HiddenField2");
         ListView    ListView3    = (ListView)TableCell1.FindControl("ListView3");
         SqlDataSourceChain.InsertParameters["IdParentQuest"].DefaultValue = HiddenField2.Value;
         int cnt_answer_checked = 0;
         for (int j = 0; j < ListView3.Items.Count; j++)
         {
             ListViewDataItem ListItem1      = (ListViewDataItem)ListView3.Items[j];
             CheckBox         ActiveCheckBox = (CheckBox)ListItem1.FindControl("ActiveCheckBox");
             if (!ActiveCheckBox.Checked)
             {
                 continue;
             }
             HiddenField HiddenField3 = (HiddenField)ListItem1.FindControl("HiddenField3");
             SqlDataSourceChain.InsertParameters["IdParentAnswer"].DefaultValue = HiddenField3.Value;
             SqlDataSourceChain.Insert();
             cnt_answer_checked++;
         }
         if (cnt_answer_checked == 0)
         {
             SqlDataSourceChain.Insert();
         }
     }
 }
Exemple #2
0
 protected void BookingDetailsGrid_rowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             TableCell  statusCell  = e.Row.Cells[3];
             TableCell  statusCell1 = e.Row.Cells[7];
             LinkButton lnkCancel   = (LinkButton)statusCell1.FindControl("lnkCancel");
             HyperLink  lnkUpdate   = (HyperLink)statusCell1.FindControl("lnkUpdate");
             LinkButton lnkUpdate1  = (LinkButton)statusCell1.FindControl("lnkUpdate1");
             DateTime   checkinDate = Convert.ToDateTime(statusCell.Text);
             int        dateDiff    = checkinDate.Subtract(System.DateTime.Now).Days;
             if (dateDiff < 1)
             {
                 //lnkCancel.Visible = false;
                 lnkCancel.OnClientClick  = "alert('You can cancel motel reservation only before 24Hours');return false;";
                 lnkUpdate1.OnClientClick = "alert('You can update motel reservation only before 24Hours');return false;";
                 lnkUpdate.Visible        = false;
             }
             else
             {
                 lnkUpdate1.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        protected void gridSettings_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            string oldKey = e.Item.Cells[0].Text;

            string    newValue  = "";
            TableCell valueCell = e.Item.Cells[2];
            TextBox   tbValue   = (valueCell.FindControl("tbValue") as TextBox);
            CheckBox  cbValue   = (valueCell.FindControl("cbValue") as CheckBox);

            if (tbValue.Visible)
            {
                newValue = tbValue.Text;
            }
            else if (cbValue.Visible)
            {
                // tolower here is not really necessary, merely for uniformity
                newValue = cbValue.Checked.ToString().ToLower();
            }
            else
            {
                throw new Exception("Unexpected condition while editing");
            }

            DbAwareSettings.Current[oldKey] = newValue;

            gridSettings.EditItemIndex = -1;
            BindSettings();
        }
        private void HideUnHideToggleButtons(TableCell cell, bool hideCollapseButton, bool hideExpandButton)
        {
            ImageButton imgExpand = (ImageButton)cell.FindControl("imgExpand");//+

            imgExpand.Visible = !hideExpandButton;
            ImageButton imgCollapse = (ImageButton)cell.FindControl("imgCollapse");//-

            imgCollapse.Visible = !hideCollapseButton;
        }
 protected void Button8_Click(object sender, EventArgs e)
 {
     SqlDataSourceScenarioFAQ.Delete();
     for (int i = 0; i < GridView5.Rows.Count; i++)
     {
         TableCell TableCell1 = (TableCell)GridView5.Rows[i].Cells[0];
         CheckBox  CheckBox1  = (CheckBox)TableCell1.FindControl("CheckBox1");
         if (!CheckBox1.Checked)
         {
             continue;
         }
         HiddenField HiddenField4 = (HiddenField)TableCell1.FindControl("HiddenField4");
         SqlDataSourceScenarioFAQ.InsertParameters["IdFAQ"].DefaultValue = HiddenField4.Value;
         SqlDataSourceScenarioFAQ.Insert();
     }
 }
Exemple #6
0
        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;

                String scageid = dataItem.GetDataKeyValue("cage_id").ToString();
                Int32  icageid = Int32.Parse(scageid);


                CageReportsDAO cagedao = new CageReportsDAO();

                decimal cg_status = cagedao.GetCageStatus(icageid);

                // for the image

                TableCell cell     = dataItem["ReadyForDespatch"];
                Button    ReadyBtn = (Button)cell.FindControl("btn_ready");

                if (cg_status == 40)//detached
                {
                    ReadyBtn.Visible = true;
                }
                else
                {
                    ReadyBtn.Visible = false;
                }
            }
        }
Exemple #7
0
    protected void dataGridFiles_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow gvr = dataGridFiles.SelectedRow;

        if (gvr != null)
        {
            int documentID = 0;
            if (GXGridView1.SelectedValue != null)
            {
                documentID = Convert.ToInt32(GXGridView1.SelectedValue);
            }
            else
            {
                documentID = GXGridView1SelectedValue;
            }
            int documentTypeID = Broker.DataAccess.DocumentType.GetByCode(Broker.DataAccess.DocumentType.PONUDA).ID;
            List <Attachment> listAttachments = Attachment.GetByDocumentTypeIDAndDocumentID(documentTypeID, documentID);
            TableCell         tc             = gvr.Cells[0];
            LinkButton        linkButton     = tc.FindControl("btnFile") as LinkButton;
            string            attachmentName = linkButton.Text;
            foreach (Attachment a in listAttachments)
            {
                string[] splitString = a.RelativePath.Split('\\');
                if (splitString[splitString.Length - 1] == attachmentName)
                {
                    File.Delete(a.RelativePath);
                    Attachment.Table.DeleteOnSubmit(a);
                    Attachment.Table.Context.SubmitChanges();
                }
            }
        }
        GenerateAllFiles();
    }
        protected void ddlPager_SelectedIndexChanged(object sender, EventArgs e)
        {
            TableCell    tc  = GridView1.BottomPagerRow.Cells[0];
            DropDownList ddl = (DropDownList)tc.FindControl("ddlPager");

            GridView1.PageIndex = ddl.SelectedIndex;
        }
    protected void ToggleSharedStatus(object sender, ImageClickEventArgs e)
    {
        ImageButton  imbtn_s = (ImageButton)sender;
        GridDataItem gdi     = (GridDataItem)imbtn_s.Parent.Parent.Parent;
        String       cpy_id  = gdi["ad_cpy_id"].Text;

        TableCell          cell = gdi[imbtn_s.CommandArgument];
        HtmlGenericControl div  = (HtmlGenericControl)cell.FindControl("div_so_" + imbtn_s.CommandArgument);

        ram_p.AjaxSettings.AddAjaxSetting(div, div); // re-ajaxify the div

        String FieldName = "SharedOn" + imbtn_s.CommandArgument;
        String uqry      = "UPDATE db_smartsocialstatus SET " + FieldName + "=(CASE WHEN " + FieldName + "=1 THEN 0 ELSE 1 END) WHERE CompanyID=@CompanyID";

        SQL.Update(uqry, "@CompanyID", cpy_id);

        if (imbtn_s.ImageUrl == "~/images/smartsocial/ico_tick.png")
        {
            imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png";
        }
        else
        {
            imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png";
        }

        Util.PageMessageSuccess(this, Server.HtmlEncode(imbtn_s.CommandArgument) + " Shared Status Updated!");
    }
Exemple #10
0
    private TextBox GetTextBox(TableCell cell, int rowId, int maxValue)
    {
        for (int i = 1; i <= maxValue; i++)
        {
            if (rowId == i)
            {
                (cell.FindControl("txtSlider" + i.ToString()) as TextBox).Visible = true;
            }
            else
            {
                (cell.FindControl("txtSlider" + i.ToString()) as TextBox).Visible = false;
            }
        }

        return(cell.FindControl("txtSlider" + rowId.ToString()) as TextBox);
    }
Exemple #11
0
        protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                bool isOwner = IsOwner(DataBinder.Eval(e.Row.DataItem, "Owner").ToString());

                // display action buttons if user is owner
                TableCell actionCell = e.Row.Cells[e.Row.Cells.Count - 1];
                actionCell.FindControl("btn_del").Visible = isOwner;

                bool quizzTaken = !(e.Row.Cells[1].Text.Equals("&nbsp;")); // pour le NULL

                // project detail on row click, except for the last cell with the action buttons

                // Only if the quizz has not been done yet
                if (!quizzTaken)
                {
                    for (int i = 0; i < e.Row.Cells.Count - 1; i++)
                    {
                        e.Row.Cells[i].Attributes["onclick"] = clientScript.GetPostBackClientHyperlink(GridView_Projects, "Select$" + e.Row.RowIndex);
                        e.Row.Cells[i].Attributes.Add("style", "cursor: pointer");
                    }
                }
                e.Row.Attributes.Add("IdQuizz", DataBinder.Eval(e.Row.DataItem, "IdQuizz").ToString());
            }
        }
Exemple #12
0
        /// <summary>
        /// 获得已选的表格行代码数组
        /// </summary>
        /// <param name="gridView">表格</param>
        /// <param name="paramChecked">选中状态</param>
        /// <param name="paramControl">控件名称</param>
        /// <returns>代码数组</returns>
        public static string[] GetSelecteIds(DataGrid dataGrid, bool paramChecked, string paramControl)
        {
            string[] paramIDs = new string[0];
            string   IDs      = string.Empty;

            for (int i = 0; i < dataGrid.Items.Count; i++)
            {
                // 得到选中的ID
                TableCell myTableCell = dataGrid.Items[i].Cells[0];
                CheckBox  myCheckBox  = (CheckBox)myTableCell.FindControl(paramControl);
                if (myCheckBox != null)
                {
                    if (myCheckBox.Checked == paramChecked)
                    {
                        // 把选中的ID保存到字符串
                        string ID = dataGrid.DataKeys[dataGrid.Items[i].ItemIndex].ToString();
                        if (ID.Length > 0)
                        {
                            IDs += ID + ",";
                        }
                    }
                }
            }
            // 切分ID
            if (IDs.Length > 1)
            {
                IDs      = IDs.Substring(0, IDs.Length - 1);
                paramIDs = IDs.Split(',').Distinct <string>().Where(t => !string.IsNullOrEmpty(t)).ToArray();
            }
            return(paramIDs);
        }
Exemple #13
0
        /// <summary>
        /// Name:createTable
        /// Description:Task: 5 Handle Selected index changed event. Display the current selected name on screen
        /// Author:Monal Shah
        /// CreatedDate:2010/10/13
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void objDrpDownLstItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            Panel2.Visible = true;
            DropDownList ComboBox = (DropDownList)sender;

            try
            {
                if (Session["ComboBox"] != null)
                {
                    string   strComboId = ComboBox.ID;
                    string[] splitValue = strComboId.Split('_');

                    Table     tblTable = (Table)Session["Table"];
                    TableRow  tblrow   = (TableRow)tblTable.FindControl("Row" + splitValue[1]);
                    TableCell tblCell  = (TableCell)tblrow.FindControl("Row" + splitValue[1] + "cell1");
                    Label     lbl      = (Label)tblCell.FindControl("Label" + splitValue[1]);

                    lbl.Text = ComboBox.SelectedItem.ToString();
                }
            }
            catch (Exception)
            {
                Response.Redirect("Error.aspx");
            }
        }
        private void setTextBoxText(TableCell cell, string text)
        {
            StringBuilder varID = new StringBuilder(cell.ID);

            varID.Remove(0, 2);
            varID.Insert(0, "TextBox");
            ((TextBox)cell.FindControl(varID.ToString())).Text = Truncate(text, 6);
        }
Exemple #15
0
 protected void gridSettings_ItemDataBound(object source, DataGridItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.EditItem)
     {
         // determine if we'll use checkbox or textbox
         object    valObj    = DataBinder.Eval(e.Item.DataItem, "CfgValue");
         string    value     = (null == valObj) ? "" : valObj.ToString();
         TableCell valueCell = e.Item.Cells[2];
         TextBox   tb        = valueCell.FindControl("tbValue") as TextBox;
         CheckBox  cb        = valueCell.FindControl("cbValue") as CheckBox;
         tb.Text = value;
         bool tmp = false;
         cb.Visible = bool.TryParse(value, out tmp);
         cb.Checked = tmp;
         tb.Visible = !cb.Visible;
     }
 }
        private string getTextBoxText(TableCell cell)
        {
            StringBuilder varID = new StringBuilder(cell.ID);

            varID.Remove(0, 2);
            varID.Insert(0, "TextBox");
            return(((TextBox)cell.FindControl(varID.ToString())).Text);
        }
Exemple #17
0
 public void Buy(String productType, GridViewCommandEventArgs e, GridView gridID)
 {
     if (e.CommandName == "Buy")
     {
         int         index      = Convert.ToInt32(e.CommandArgument);
         GridViewRow row        = gridID.Rows[index];
         String      clientID   = client.ID;
         TableCell   cellNumber = row.Cells[1];
         TextBox     numberBox  = cellNumber.FindControl("numberToBuy") as TextBox;
         int         number     = Convert.ToInt32(numberBox.Text);
         TableCell   cellID     = row.Cells[4];
         int         id         = Convert.ToInt32(cellID.Text);
         try
         {
             management.ClientBuy(connectionString, clientsTable, clientID, productType, id, number);
             LoadData();
         }
         catch //DoubleException exception)
         {
             //errorLabel.Text = exception.Message;
         }
     }
     else if (e.CommandName == "Plus")
     {
         int         index    = Convert.ToInt32(e.CommandArgument);
         GridViewRow row      = gridID.Rows[index];
         String      clientID = client.ID;
         TableCell   cellID   = row.Cells[4];
         int         id       = Convert.ToInt32(cellID.Text);
         try
         {
             management.AddOrSubtract(connectionString, clientsTable, clientID, productType, id, true);
             LoadData();
         }
         catch
         {
             //errorLabel.Text = exception.Message;
         }
     }
     else
     {
         int         index    = Convert.ToInt32(e.CommandArgument);
         GridViewRow row      = gridID.Rows[index];
         String      clientID = client.ID;
         TableCell   cellID   = row.Cells[4];
         int         id       = Convert.ToInt32(cellID.Text);
         try
         {
             management.AddOrSubtract(connectionString, clientsTable, clientID, productType, id, false);
             LoadData();
         }
         catch
         {
             //errorLabel.Text = exception.Message;
         }
     }
 }
Exemple #18
0
        private void SubmitterGrid_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            TableCell  cell         = e.Item.Cells[2];
            LinkButton link         = (LinkButton)cell.FindControl("ShowHideBtn");
            Label      messageLabel = (Label)cell.FindControl("MessageLbl");

            if (messageLabel.Visible == true)
            {
                // hide it
                messageLabel.Visible = false;
                link.Text            = "Show Message";
            }
            else
            {
                // show it
                messageLabel.Visible = true;
                link.Text            = "Hide Message";
            }
        }
Exemple #19
0
        private void FacultyGrid_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            TableCell  cell       = e.Item.Cells[2];
            LinkButton link       = (LinkButton)cell.FindControl("ShowHideBtn0");
            Label      proofLabel = (Label)cell.FindControl("ProofLbl");

            if (proofLabel.Visible == true)
            {
                // hide it
                proofLabel.Visible = false;
                link.Text          = "Show Evidence";
            }
            else
            {
                // show it
                proofLabel.Visible = true;
                link.Text          = "Hide Evidence";
            }
        }
        private string getNextStageText(TableCell cell)
        {
            StringBuilder varID = new StringBuilder(cell.ID);

            varID.Remove(0, 2);
            int IDNumber = int.Parse(varID.ToString());

            IDNumber += 7;
            return(((TextBox)cell.FindControl("TextBox" + IDNumber.ToString())).Text);
        }
Exemple #21
0
        protected void OnGridRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                var gv = sender as GridView;
                if (gv == null)
                {
                    return;
                }
                var            keys = gv.DataKeys[e.RowIndex];
                TableCell      cell = gv.Rows[e.RowIndex].Cells[0];
                ParamInfoModel mode = new ParamInfoModel();
                mode.ID         = keys.Value.ToInt();
                mode.ContractID = ddContract.Text.ToInt();
                mode.ParamType  = keys.Values[1].ToInt();
                mode.Field      = ((TextBox)cell.FindControl("txtField")).Text.Trim();
                mode.FieldType  = ((DropDownList)cell.FindControl("droFieldType")).SelectedValue.ToEnum <FieldType>();
                mode.Remark     = JoinArray(',', ((TextBox)cell.FindControl("hiDescption")).Text.Trim(),
                                            ((TextBox)cell.FindControl("txtDescption")).Text.Trim());//合并到Remark字段
                mode.Descption = "";

                var conRequired = (DropDownList)cell.FindControl("droRequired");
                if (conRequired != null)
                {
                    mode.Required = Convert.ToBoolean(conRequired.Text);
                }
                mode.SortID     = -1;
                mode.ModifyDate = MathUtils.Now;
                if (DbDataLoader.Update(mode))
                {
                    gv.EditIndex = -1;
                    BindResult();
                }
            }

            catch (Exception erro)
            {
                TraceLog.WriteError("RowUpdating:{0}", erro);
                Response.Write("错误信息:" + erro.Message);
            }
        }
        protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                bool isOwner = IsOwner(DataBinder.Eval(e.Row.DataItem, "OwnerId").ToString());

                // display action buttons if user is owner
                TableCell actionCell = e.Row.Cells[e.Row.Cells.Count - 1];
                actionCell.FindControl("btn_edit").Visible = isOwner;
                actionCell.FindControl("btn_del").Visible  = isOwner;


                // project detail on row click, except for the last cell with the action buttons
                for (int i = 0; i < e.Row.Cells.Count - 1; i++)
                {
                    e.Row.Cells[i].Attributes["onclick"] = clientScript.GetPostBackClientHyperlink(GridView_Projects, "Select$" + e.Row.RowIndex);
                    e.Row.Cells[i].Attributes.Add("style", "cursor: pointer");
                }
                e.Row.Attributes.Add("idProject", DataBinder.Eval(e.Row.DataItem, "IdProject").ToString());
            }
        }
Exemple #23
0
        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;



                // for the image

                TableCell cell = dataItem["select"];

                Label     SelectText = (Label)cell.FindControl("drilldown");
                HyperLink _myLink    = (HyperLink)cell.FindControl("HyperLink1");

                string criterion = dataItem.GetDataKeyValue("criterion_name").ToString();

                string drill = ((DataRowView)e.Item.DataItem).Row["criterion_type"].ToString();
                Int32  type  = 0;

                if (drill != null && drill != string.Empty)
                {
                    type = Int32.Parse(drill);
                }
                if (type == 1)
                {
                    //SelectText.Text = "Select";
                    _myLink.Text        = "Select";
                    _myLink.NavigateUrl = "~/Pages/Dashboard/PackPriorityValue.aspx?criterion_name=" + criterion;
                }

                else
                {
                    //SelectText.Visible = false;
                    _myLink.Visible = false;
                }
            }
        }
Exemple #24
0
        private void EditButton(TableCell cell, string idEntrada, string idSalida)
        {
            var module = Usuario.Modules[GetRefference()];
            var pan    = cell.FindControl("panEdit") as Panel;

            if (pan == null && module.Edit)
            {
                pan = new Panel {
                    ID = "panEdit"
                };
                var btEdit2 = new ResourceLinkButton {
                    ID = "btEdit", ResourceName = "Controls", VariableName = "BUTTON_EDIT", CommandName = "Editar", CommandArgument = idEntrada + ":" + idSalida, CausesValidation = false
                };
                pan.Controls.Add(btEdit2);
                cell.Controls.Add(pan);
            }
            var btEdit = cell.FindControl("btEdit") as IButtonControl;

            if (btEdit != null)
            {
                btEdit.Command += btEdit_Command;
            }
        }
        protected void GridView1_DataBound(object sender, EventArgs e)
        {
            TableCell tc = GridView1.BottomPagerRow.Cells[0];

            string page    = "Page " + (GridView1.PageIndex + 1) + " of " + GridView1.PageCount;
            Label  lblInfo = (Label)tc.FindControl("lblInfo");

            lblInfo.Text = page;

            DropDownList ddlPager = (DropDownList)tc.FindControl("ddlPager");
            ListItem     item;

            for (int i = 1; i <= GridView1.PageCount; i++)
            {
                item = new ListItem(i.ToString());
                //item.Text = i.ToString();
                if (GridView1.PageIndex == i - 1)
                {
                    item.Selected = true;
                }
                ddlPager.Items.Add(item);
            }
        }
 /// <summary>
 /// Sets the current value of the specified <see cref="TableCell"/> object.
 /// </summary>
 /// <param name="cell">The current <see cref="TableCell"/> object.</param>
 /// <param name="controlId">The nested control's ID property value.</param>
 /// <param name="controlProperty">The nested control's value property name.</param>
 /// <param name="value">The current value.</param>
 public void SetValue(TableCell cell, String controlId, String controlProperty, Object value)
 {
     if (cell != null)
     {
         if (String.IsNullOrEmpty(controlId))
         {
             cell.Text = String.Format("{0}", value);
         }
         else
         {
             Control control = cell.FindControl(controlId);
             FormUtil.SetValue(control, controlProperty, value);
         }
     }
 }
        /// <summary>
        /// Gets the current value of the specified <see cref="TableCell"/> object.
        /// </summary>
        /// <param name="cell">The current <see cref="TableCell"/> object.</param>
        /// <param name="controlId">The nested control's ID property value.</param>
        /// <param name="controlProperty">The nested control's value property name.</param>
        /// <returns>The current value.</returns>
        public Object GetValue(TableCell cell, String controlId, String controlProperty)
        {
            Object value = null;

            if (String.IsNullOrEmpty(controlId))
            {
                value = cell.Text;
            }
            else
            {
                Control control = cell.FindControl(controlId);
                value = FormUtil.GetValue(control, controlProperty);
            }

            return(value);
        }
    protected void ToggleStatus(object sender, ImageClickEventArgs e)
    {
        ImageButton  imbtn_s = (ImageButton)sender;
        GridDataItem gdi     = (GridDataItem)imbtn_s.Parent.Parent.Parent;
        String       cpy_id  = gdi["feat_cpy_id"].Text;

        bool IgnoreCall = imbtn_s.CommandArgument == "Ignored";

        if (!IgnoreCall)
        {
            TableCell          cell = gdi[imbtn_s.CommandArgument];
            HtmlGenericControl div  = (HtmlGenericControl)cell.FindControl("div_so_" + imbtn_s.CommandArgument);
            ram.AjaxSettings.AddAjaxSetting(div, div); // re-ajaxify the div
        }

        String FieldName = "SharedOn" + imbtn_s.CommandArgument;

        if (IgnoreCall)
        {
            FieldName = "Ignored";
        }

        String uqry = "UPDATE db_smartsocialstatus SET " + FieldName + "=(CASE WHEN " + FieldName + "=1 THEN 0 ELSE 1 END) WHERE CompanyID=@CompanyID";

        SQL.Update(uqry, "@CompanyID", cpy_id);

        if (!IgnoreCall)
        {
            //div.Style.Add("background", "#ffeedd");//div.Style.Add("background", "#dcfadc");
            if (imbtn_s.ImageUrl == "~/images/smartsocial/ico_tick.png")
            {
                imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png";
            }
            else
            {
                imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png";
            }

            Util.PageMessageSuccess(this, Server.HtmlEncode(imbtn_s.CommandArgument) + " Shared Status Updated!");
        }
        else
        {
            BindFeatures();
            Util.PageMessageSuccess(this, Server.HtmlEncode(imbtn_s.CommandName) + " Hidden!");
        }
    }
Exemple #29
0
        /// <summary>
        /// 获得已选的表格行代码数组
        /// </summary>
        /// <param name="gridView">表格</param>
        /// <param name="paramChecked">选中状态</param>
        /// <param name="paramControl">控件名称</param>
        /// <returns>代码数组</returns>
        public static string[] GetSelecteIds(GridView gridView, bool paramChecked, string paramControl, string key)
        {
            string[] ids    = new string[0];
            string   idList = string.Empty;

            for (int i = 0; i < gridView.Rows.Count; i++)
            {
                // 得到选中的ID
                if (gridView.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    TableCell tableCell = gridView.Rows[i].Cells[0];
                    CheckBox  checkBox  = (CheckBox)tableCell.FindControl(paramControl);
                    if (checkBox != null)
                    {
                        if (checkBox.Checked == paramChecked)
                        {
                            // 把选中的ID保存到字符串
                            string id = string.Empty;
                            if (string.IsNullOrEmpty(key))
                            {
                                id = gridView.DataKeys[gridView.Rows[i].RowIndex].Value.ToString();
                            }
                            else
                            {
                                id = gridView.DataKeys[gridView.Rows[i].RowIndex].Values[key].ToString();
                            }

                            if (id.Length > 0)
                            {
                                idList += id + ",";
                            }
                        }
                    }
                }
            }
            // 切分ID
            if (idList.Length > 1)
            {
                idList = idList.Substring(0, idList.Length - 1);
                ids    = idList.Split(',').Distinct <string>().Where(t => !string.IsNullOrEmpty(t)).ToArray();
            }
            return(ids);
        }
Exemple #30
0
        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;



                // for the image

                TableCell cell          = dataItem["item_status"];
                Image     completeImage = (Image)cell.FindControl("completeimage");
                //Label locatedText = (Label)cell.FindControl("itemslocated");

                string located = ((DataRowView)e.Item.DataItem).Row["item_status_cd"].ToString();
                Int32  change  = 0;

                if (located != null && located != string.Empty)
                {
                    change = Int32.Parse(located);
                }
                if (change == 110)
                {
                    completeImage.ImageUrl = "~/Images/green.gif";
                    //changeText.Style["color"] = "green";
                }
                else if (change == 90)
                {
                    completeImage.ImageUrl = "~/Images/yellow.gif";
                    //changeText.Style["color"] = "red";
                }
                else if (change < 90 && change != 0)
                {
                    completeImage.ImageUrl = "~/Images/red.gif";
                }
                else
                {
                    completeImage.Visible = false;
                }
            }
        }
    private AttributeUc InitAttributeUc(TableCell cell)
    {
        AttributeUc auc1 = cell.FindControl("auc1") as AttributeUc;

        Label laid = cell.FindControl("laid") as Label;

        auc1.AttributeID = BaseItem.ToInt32(laid.Text);
        auc1.Attribute = Attributes[rowIndex];
        auc1.RowIndex = rowIndex++;

        auc1.Uc.ServiceID = Uc.ServiceID;
        auc1.Uc.CategoryID = Uc.CategoryID;
        auc1.Uc.ItemID = Uc.ItemID;
        auc1.Uc.LayoutID = Uc.LayoutID;
        auc1.Uc.TableName = Uc.TableName;

        if (Uc.LayoutID == LayoutE.SearchResult || Uc.LayoutID == LayoutE.View)
        {
            ituc1.Uc.ServiceID = Uc.ServiceID;
            ituc1.Uc.CategoryID = Uc.CategoryID;
            ituc1.Uc.ItemID = Uc.ItemID;
            ituc1.Uc.LayoutID = Uc.LayoutID;
            ituc1.Uc.TableName = Uc.TableName;

            ituc1.InitControl();
        }

        if (Uc.LayoutID == LayoutE.SearchResult)
        {
            ph3.Visible = true;

            imgc.ImageUrl = Category.IconUrl(Uc.CategoryID);
            imgc.AlternateText = Uc.Category.Name;
            imgc.ToolTip = Uc.Category.Name;
            imgc.Visible = true;

            lnks.Text = Uc.Service.Name;
            lnks.NavigateUrl = UWeb.GetUrlServiceSearch(Uc.ServiceID, SearchTypeE.Browse);

            lnkc.Text = Uc.Category.Name;
            lnkc.NavigateUrl = UWeb.GetUrlItemSearch(Uc.ServiceID, Uc.CategoryID, SearchTypeE.Browse);
        }

        return auc1;
    }