protected void UpdateValues(GridDataItem updatedItem)
        {
            TextBox txtBox = (TextBox)updatedItem.FindControl("txtBoxName");
            SqlDataSource1.UpdateParameters["ProductName"].DefaultValue = txtBox.Text;

            txtBox = (TextBox)updatedItem.FindControl("txtQuantityPerUnit");
            SqlDataSource1.UpdateParameters["QuantityPerUnit"].DefaultValue = txtBox.Text;

            txtBox = (TextBox)updatedItem.FindControl("txtUnitPrice");
            SqlDataSource1.UpdateParameters["UnitPrice"].DefaultValue = txtBox.Text;

            txtBox = (TextBox)updatedItem.FindControl("txtUnitsOnOrder");
            SqlDataSource1.UpdateParameters["UnitsOnOrder"].DefaultValue = txtBox.Text;

            DropDownList ddl = (DropDownList)updatedItem.FindControl("ddlUnitsInStock");
            SqlDataSource1.UpdateParameters["UnitsInStock"].DefaultValue = ddl.SelectedValue;

            CheckBox chkBox = (CheckBox)updatedItem.FindControl("chkBoxDiscontinued");
            SqlDataSource1.UpdateParameters["Discontinued"].DefaultValue = chkBox.Checked.ToString();

            SqlDataSource1.UpdateParameters["ProductID"].DefaultValue = updatedItem.GetDataKeyValue("ProductID").ToString();

            try
            {
                SqlDataSource1.Update();
            }
            catch (Exception ex)
            {
                SetMessage(Server.HtmlEncode("Unable to update Products. Reason: " + ex.StackTrace).Replace("'", "&#39;").Replace("\r\n", "<br />"));
            }
            SetMessage("Product with ID: " + updatedItem.GetDataKeyValue("ProductID") + " updated");

        }
		private void ShowMDSButtons(GridDataItem item, bool showTheButtons)
		{
            // ------------------------------------------
            // check to make sure the user have permissions to add otherwise do not show button
            if (Session["KenticoUserInfo"] == null) return;

            var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"];

            var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName);
            var currentUser = new CurrentUserInfo(userInfo, true);

            if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm"))
            {
                var button = (ImageButton)item.FindControl("AddAsNewMyDocsResource");
                if (button != null)
                {
                    button.Enabled = false;
                    button.CssClass = "disabledButton";
                }
                //item.FindControl("AddAsNewMyDocsResource").Visible = false;
                return;
            }
            // ------------------------------------------

			item.FindControl("AddAsNewMyDocsResource").Visible = showTheButtons;
			//item.FindControl("AddAsNewDistrictResource").Visible = showTheButtons;
			//item.FindControl("AddAsNewStateResource").Visible = showTheButtons;
		}
        private void Delete(GridDataItem gdItem)
        {
            int ID;
            try
            {
                ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["UserID"]);
                DeleteRecord(ID);
            }
            catch (Exception ex)
            {

            }
        }
 private void Edit(GridDataItem gdItem)
 {
     int ID;
     try
     {
         ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["GroupID"]);
         string idStr = ID.ToString();
         ShowRecord(idStr);
     }
     catch (Exception ex)
     {
         am.Utility.ShowHTMLMessage(Page, "000", ex.Message);
     }
 }
 //Prüfen ob alle Werte da sind um den Auftrag auf "Zulassungstelle" zu setzen
 private bool CheckIfAllExistsToUpdate(GridDataItem fertigStellenItem)
 {
     bool shouldBeUpdated = true;
     if (String.IsNullOrEmpty(fertigStellenItem["VIN"].Text))
     {
         shouldBeUpdated = false;
     }
     return shouldBeUpdated;
 }
Example #6
0
 protected void OnCheckedChanged(object sender, EventArgs e)
 {
     GridDataItem item   = (sender as Button).Parent.Parent as GridDataItem;
     TextBox      txtBox = item.FindControl("TextBox1") as TextBox;
 }
        private void DeleteAttachment(GridDataItem gdItem)
        {
            try
            {
                string filepath = gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["FilePath"].ToString();

                am.DataAccess.BatchQuery.Delete("POAttach", "FilePath=@FilePath", new string[] { POAttachmentfolderPath + "/" + filepath });
                if (am.DataAccess.BatchQuery.Execute())
                {
                    String targetFolder = Server.MapPath(POAttachmentfolderPath);
                    string path = Path.Combine(targetFolder, filepath);
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    LoadPOAttachmentInfo();
                }
            }
            catch (Exception ex)
            {
                am.Utility.ShowHTMLMessage(Page, "000", ex.Message);
            }
        }
        private void EditRecord(GridDataItem gdItem)
        {
            int ID;
            ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["DonorID"]);
            string idStr = ID.ToString();

            DataTable dt = null;
            DataRow dr = null;

            dt = am.DataAccess.RecordSet("select * from Donor WHERE DonorID=@DonorID", new string[] { idStr });
            if (dt != null && dt.Rows.Count > 0)
            {
                dr = dt.Rows[0];
            }

            if (dr != null)
            {
                //Store Id
                hdfId.Value = idStr;

                tbxName.Text = dr["DonorName"].ToString();
                tbxMinAmount.Text = dr["MinAmount"].ToString();
                chkActive.Checked = Convert.ToBoolean(dr["Active"]);
            }
        }
        protected void ddlAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //DropDownList ddlAction = (DropDownList)sender;
                //GridViewRow gvr = (GridViewRow)ddlAction.NamingContainer;
                //int selectedRow = gvr.RowIndex;

                RadComboBox  ddlAction   = (RadComboBox)sender;
                GridDataItem gvr         = (GridDataItem)ddlAction.NamingContainer;
                int          selectedRow = gvr.ItemIndex + 1;

                EQAccountId               = int.Parse(gvEQAcc.MasterTableView.DataKeyValues[selectedRow - 1]["AccountId"].ToString());
                Session["AccountId"]      = EQAccountId;
                Session["EQAccountVoRow"] = CustomerTransactionBo.GetCustomerEQAccountDetails(EQAccountId, portfolioId);
                if (ddlAction.SelectedValue.ToString() == "Edit")
                {
                    if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('CustomerEQAccountAdd','action=Edit');", true);
                    }
                }
                if (ddlAction.SelectedValue.ToString() == "View")
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('CustomerEQAccountAdd','action=View');", true);
                }
                if (ddlAction.SelectedValue.ToString() == "Delete")
                {
                    if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true);
                    }
                    else
                    {
                        bool CheckTradeAccAssociationWithTransactions;
                        CheckTradeAccAssociationWithTransactions = CustomerTransactionBo.CheckEQTradeAccNoAssociatedWithTransactions(EQAccountId);

                        if (CheckTradeAccAssociationWithTransactions == true)
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Trade Account can not be deleted as some Transactions are Associated with this Trade Account Number.');", true);
                        }
                        else if (CheckTradeAccAssociationWithTransactions == false)
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "ShowAlertToDelete();", true);
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "CustomerMFFolioView.ascx:ddlAction_OnSelectedIndexChange()");
                object[] objects = new object[1];
                objects[0]   = FolioId;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
		protected void HideUncheckedItems(RadGrid grid)
		{
			bool checkedAll = false;
			bool anyItemIsChecked = false;
			CheckBox allCheckbx = new CheckBox();
			GridDataItem allItem = new GridDataItem(new GridTableView(grid), 0, 0 );

			foreach (GridDataItem item in grid.Items)
			{
				CheckBox checkbx = (CheckBox)item.FindControl("checked");
				if (item["category"].Text == "All" && checkbx.Checked)
				{
					checkedAll = true;
					allCheckbx = checkbx;
					allItem = item;
					anyItemIsChecked = true;
					break;
				}
			}

			foreach (GridDataItem item in grid.Items)
			{
				CheckBox checkbx = (CheckBox)item.FindControl("checked");
				checkbx.Checked = checkedAll ? false : checkbx.Checked;

				if (checkbx.Checked) anyItemIsChecked = true;
	
				item.Display = checkbx.Checked; //hide the row
				item.Enabled = true;
			}
			if (checkedAll)
			{
				allCheckbx.Checked = true;
				allItem.Display = true;
			}
			if(!anyItemIsChecked)
			{
				grid.DataSource = "";
				grid.DataBind();
			}
			
		}
 /// <summary>
 /// Method that retrieves the DataKeyValue related to a RadGrid based on the GridDataItem(Row) selected
 /// </summary>
 /// <param name="item">The row selected in the RadGrid for Add/Remove</param>
 /// <returns></returns>
 private int GetStudentIDFromGridItem(GridDataItem item)
 {
     return Int32.Parse(item.GetDataKeyValue("ID").ToString());
 }
        private void Edit(GridDataItem gdItem)
        {
            int ID;
            try
            {
                ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["VendorID"]);
                string idStr = ID.ToString();
                ShowRecord(idStr);
                tabMain.SelectedIndex = 0;
                mpgPages.SelectedIndex = 0;
            }
            catch (Exception ex)
            {

            }
        }
 private void Delete(GridDataItem gdItem)
 {
     int ID;
     ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["VendorID"]);
     DeleteRecord(ID);
 }
        private void ManageHandler(GridDataItem item)
        {
            string value = "";
            try
            {
                TableCell cell = (TableCell)item["REFNO"];
                if (cell.Text != "&nbsp;")
                    value = cell.Text;

                switch (rblType.SelectedValue)
                {
                    case "PR":
                        if (cboStatus.Text == "ASSIGNED")
                        {
                            Response.Redirect("PRAssign.aspx?prno=" + value + "&type=apr");
                        }
                        else if (cboStatus.Text == "UNASSIGNED")
                        {
                            Response.Redirect("PRAssign.aspx?prno=" + value + "&type=upr");
                        }
                        else
                        {
                            Response.Redirect("PRAssign.aspx?prno=" + value + "&type=apr");
                        }
                        break;
                    case "RFQ":
                        if (cboStatus.Text == "PENDING PR")
                        {
                            Response.Redirect("Invitation.aspx?invId=" + value + "&type=pr");
                        }
                        else
                        {
                            Response.Redirect("Invitation.aspx?invId=" + value + "&type=rfq");
                        }
                        break;
                    case "SELECTION":
                        if (cboStatus.Text == "PENDING")
                        {
                            string type = "PR";
                            TableCell cell1 = (TableCell)item["COL1"];
                            if (cell1.Text.Contains("RFQ"))
                                type = "RFQ";
                            else if (cell1.Text.Contains("RFP"))
                                type = "RFP";
                            else if (cell1.Text.Contains("IFT"))
                                type = "IFT";

                            Response.Redirect("VendorSelection.aspx?selectionId=" + value + "&type=" + type + "");
                        }
                        else
                        {
                            Response.Redirect("VendorSelection.aspx?selectionId=" + value + "&type=selected");
                        }
                        break;
                    case "PO":
                        if (cboStatus.Text == "PENDING SELECTION")
                        {
                            Response.Redirect("PurchaseOrder.aspx?poId=" + value + "&type=sel");
                        }
                        else
                        {
                            Response.Redirect("PurchaseOrder.aspx?poId=" + value + "&type=po");
                        }
                        break;
                    case "GRN":
                        if (cboStatus.Text == "PENDING PO")
                        {
                            Response.Redirect("GRNSCN.aspx?grnscnId=" + value + "&type=po");
                        }
                        else
                        {
                            Response.Redirect("GRNSCN.aspx?grnscnId=" + value + "&type=grn");
                        }
                        break;
                    case "PAYMENT":
                        if (cboStatus.Text == "PENDING PO")
                        {
                            Response.Redirect("Payment.aspx?paymentId=" + value + "&type=po");
                        }
                        else
                        {
                            Response.Redirect("Payment.aspx?paymentId=" + value + "&type=pmt");
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                am.Utility.ShowHTMLMessage(Page, "0000", ex.Message);
            }
        }
Example #15
0
        protected void btnAnadirPapel_Click(object sender, EventArgs e)
        {
            int Gramaje = Convert.ToInt32(lblGramaje.Text.Replace(".", ""));
            int Ancho   = Convert.ToInt32(lblAncho.Text.Replace(".", ""));
            int largo   = Convert.ToInt32(lblLargo.Text.Replace(".", ""));

            if (gv1.Rows.Count > 0)
            {
                List <BodegaPliegos> lnewAsignados    = new List <BodegaPliegos>();
                List <BodegaPliegos> lnewSinAsignados = new List <BodegaPliegos>();
                for (int i = 0; i < RadGrid1.Items.Count; i++)
                {
                    GridDataItem row       = RadGrid1.Items[i];
                    bool         isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;

                    if (isChecked)
                    {
                        BodegaPliegos b = new BodegaPliegos();
                        b.ID             = RadGrid1.Items[i]["ID"].Text;
                        b.CodigoProducto = RadGrid1.Items[i]["CodigoProducto"].Text;
                        b.Papel          = RadGrid1.Items[i]["Papel"].Text;
                        b.Cliente        = RadGrid1.Items[i]["Cliente"].Text;
                        b.Sector         = RadGrid1.Items[i]["Sector"].Text;
                        b.Ubicacion      = RadGrid1.Items[i]["Ubicacion"].Text;
                        b.NroPallet      = RadGrid1.Items[i]["NroPallet"].Text;
                        b.Gramaje        = RadGrid1.Items[i]["Gramaje"].Text;
                        b.Ancho          = RadGrid1.Items[i]["Ancho"].Text;
                        b.Largo          = RadGrid1.Items[i]["Largo"].Text;
                        b.StockFL        = RadGrid1.Items[i]["StockFL"].Text;
                        b.Antiguedad     = RadGrid1.Items[i]["Antiguedad"].Text;
                        lnewAsignados.Add(b);

                        // BodegaPliegos itemToRemove = lista.SingleOrDefault(r => r.ID == row["ID"].Text);
                    }
                    else
                    {
                        BodegaPliegos b = new BodegaPliegos();
                        b.ID             = RadGrid1.Items[i]["ID"].Text;
                        b.CodigoProducto = RadGrid1.Items[i]["CodigoProducto"].Text;
                        b.Papel          = RadGrid1.Items[i]["Papel"].Text;
                        b.Cliente        = RadGrid1.Items[i]["Cliente"].Text;
                        b.Sector         = RadGrid1.Items[i]["Sector"].Text;
                        b.Ubicacion      = RadGrid1.Items[i]["Ubicacion"].Text;
                        b.NroPallet      = RadGrid1.Items[i]["NroPallet"].Text;
                        b.Gramaje        = RadGrid1.Items[i]["Gramaje"].Text;
                        b.Ancho          = RadGrid1.Items[i]["Ancho"].Text;
                        b.Largo          = RadGrid1.Items[i]["Largo"].Text;
                        b.StockFL        = RadGrid1.Items[i]["StockFL"].Text;
                        b.Antiguedad     = RadGrid1.Items[i]["Antiguedad"].Text;
                        lnewSinAsignados.Add(b);
                    }
                }
                for (int i = 0; i <= gv1.Rows.Count - 1; i++)
                {
                    BodegaPliegos c = new BodegaPliegos();
                    c.ID             = gv1.Rows[i].Cells[0].Text;
                    c.CodigoProducto = gv1.Rows[i].Cells[1].Text;
                    c.Papel          = gv1.Rows[i].Cells[2].Text;
                    c.Cliente        = gv1.Rows[i].Cells[3].Text;
                    c.Sector         = gv1.Rows[i].Cells[4].Text;
                    c.Ubicacion      = gv1.Rows[i].Cells[5].Text;
                    c.NroPallet      = gv1.Rows[i].Cells[6].Text;
                    c.Gramaje        = gv1.Rows[i].Cells[7].Text;
                    c.Ancho          = gv1.Rows[i].Cells[8].Text;
                    c.Largo          = gv1.Rows[i].Cells[9].Text;
                    c.StockFL        = gv1.Rows[i].Cells[11].Text;
                    c.Antiguedad     = gv1.Rows[i].Cells[10].Text;
                    lnewAsignados.Add(c);
                }
                RadGrid1.DataSource = lnewSinAsignados;
                RadGrid1.DataBind();

                gv1.DataSource = lnewAsignados;
                gv1.DataBind();
            }
            else
            {
                int v = 0; int id = Convert.ToInt32(Request.QueryString["id"]);
                lista = bp.ListadoDetalleSKU(id.ToString(), "", "", 0, "", "", 0, 0, 0, "", 0, "", "", 2, 0);



                for (int i = 0; i < RadGrid1.Items.Count; i++)
                {
                    GridDataItem row       = RadGrid1.Items[i];
                    bool         isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;

                    if (isChecked)
                    {
                        if (Convert.ToInt32(RadGrid1.Items[i]["Gramaje"].Text) >= Gramaje && Convert.ToInt32(RadGrid1.Items[i]["Ancho"].Text) >= Ancho && Convert.ToInt32(RadGrid1.Items[i]["Largo"].Text) >= largo)
                        {
                            BodegaPliegos itemToRemove = lista.SingleOrDefault(r => r.ID == row["ID"].Text);
                            lista2.Add(itemToRemove);
                            v = v + 1;
                            if (itemToRemove != null)
                            {
                                lista.Remove(itemToRemove);
                                //row["NumeroOT"].Text;
                            }
                        }
                        else
                        {
                            string popupScript = "<script language='JavaScript'>alert('¡El formato del papel no es el correcto. El gramaje, ancho y largo debe ser igual o mayor al solicitado!');</script>";
                            Page.RegisterStartupScript("PopupScript", popupScript);
                        }
                    }
                    else
                    {
                    }
                }


                RadGrid1.DataSource = lista;
                RadGrid1.DataBind();

                gv1.DataSource = lista2;
                gv1.DataBind();
            }

            for (int i = 0; i <= gv1.Rows.Count - 1; i++)
            {
                ((TextBox)gv1.Rows[i].FindControl("txtCantidad")).Attributes.Add("onkeypress", "return solonumeros(event);");
            }
            // lblTitulo.Text = v.ToString();
        }
        protected void grdClientes_ItemCommand(object sender, GridCommandEventArgs e)
        {
            string id_Sectorista;
            string stringPeriodo;
            string strId_Cliente;

            string year;
            string mes;
            string day;

            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }
            try
            {
                if (e.CommandName == "Gestion")
                {
                    year = rmyReporte.SelectedDate.Value.Year.ToString();
                    mes  = rmyReporte.SelectedDate.Value.Month.ToString();

                    if (mes.Length == 1)
                    {
                        mes = "0" + mes;
                    }

                    GridDataItem dataitem = (GridDataItem)e.Item;
                    string       ID_Zona  = dataitem.GetDataKeyValue("Id_Zona").ToString();

                    strId_Cliente            = e.CommandArgument.ToString();
                    Session["strId_Cliente"] = strId_Cliente;


                    if (ID_Zona != "0")
                    {
                        stringPeriodo = year + "" + mes;
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "ShowCreateViewGestion(" + strId_Cliente + "," + ViewState["id_Sectorista"] + "," + ID_Zona + "," + stringPeriodo + ");", true);
                    }
                    else
                    {
                        lblMensaje.Text     = "No se realizó la proyección del cliente para el periodo seleccionado.!!";
                        lblMensaje.CssClass = "mensajeError";

                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "buscarError();", true);
                    }
                }

                if (e.CommandName == "PeriodoDeuda")
                {
                    year = rmyReporte.SelectedDate.Value.Year.ToString();
                    mes  = rmyReporte.SelectedDate.Value.Month.ToString();

                    if (mes.Length == 1)
                    {
                        mes = "0" + mes;
                    }

                    stringPeriodo = year + "" + mes;

                    GridDataItem dataitem   = (GridDataItem)e.Item;
                    string       id_Cliente = dataitem.GetDataKeyValue("id_Cliente").ToString();

                    id_Cliente = "1" + id_Cliente;
                    string id_sectorista = ViewState["id_Sectorista"].ToString();

                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "ShowCreateViewDeuda(" + id_Cliente + "," + id_sectorista + ");", true);
                }
                if (e.CommandName == "EstadoCuenta")
                {
                    GridDataItem dataitem = (GridDataItem)e.Item;

                    string ID_zona    = dataitem.GetDataKeyValue("Id_Zona").ToString();
                    string ID_Cliente = "1" + e.CommandArgument.ToString();

                    id_Sectorista = "1" + ViewState["id_Sectorista"].ToString();
                    string strFecha;
                    year = rmyReporte.SelectedDate.Value.Year.ToString();
                    mes  = rmyReporte.SelectedDate.Value.Month.ToString();

                    if (int.Parse(mes) < 10)
                    {
                        mes = "0" + mes;
                    }

                    strFecha = year + "" + mes;

                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "ShowCreateViewEstadoCuenta(" + ID_Cliente + "," + strFecha + "," + id_Sectorista + "," + ID_zona + ");", true);

                    //Response.Redirect("~/Finanzas/Cobranzas/Proyeccion/frmEstadoCuenta.aspx?id_cliente=" + e.CommandArgument.ToString() + "&fechaInicial=" + ((DateTime)ViewState["fechaInicial"]).ToString("dd/MM/yyyy") + "&ID_Vendedor=" + ID_Vendedor + "&ID_Sectorista=" + id_Sectorista + "&ID_zona=" + ID_zona);
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Example #17
0
    protected void RadGrid1_ItemCommand1(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "displaycomments")
        {
            comment.Visible = true;
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label        k        = (Label)dataItem.FindControl("itemid");
            int          itemid   = int.Parse(k.Text);

            Db        dbClass = new Db();
            DataTable dt      = new DataTable();
            string    getc    = @"SELECT     [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, Propic.Image, Propic.[Current]
FROM         [User] INNER JOIN
                      Comments ON [User].ID = Comments.UID INNER JOIN
                      Propic ON Comments.UID = Propic.UID
WHERE     (Comments.ItemID = " + itemid + @") AND (Propic.[Current] = 1)
ORDER BY CID";
            dt = dbClass.ReturnDT(getc);
            RadGrid2.Columns.FindByUniqueName("loadit").HeaderText = "Comments";
            if (dt.Rows.Count == 0)
            {
                lblstatus.Visible = true;
                lblstatus.Text    = "No Comments";
                RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text;
                vaibhav.Visible = false;
            }
            else
            {
                lblstatus.Visible = false;
                RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text;
                RadGrid2.DataSource = dt;
                RadGrid2.DataBind();
                vaibhav.Visible = true;
            }
        }
        else if (e.CommandName == "phew")
        {
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label        k        = (Label)dataItem.FindControl("itemid");
            int          itemid   = int.Parse(k.Text);
            comment.Visible = false;
            int    z     = int.Parse(Session["UserID"].ToString());
            string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + itemid + ")";
            dbClass.DataBase(iphew);

            LinkButton lk = (LinkButton)dataItem.FindControl("phew");

            //How Much..
            DataTable dt        = new DataTable();
            string    getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
            dt             = dbClass.ReturnDT(getcvalue);
            lk.Text        = "Unphew(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "unphew";
        }
        else if (e.CommandName == "unphew")
        {
            // DELETE FROM Persons
//WHERE LastName='Tjessem' AND FirstName='Jakob'
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label        k        = (Label)dataItem.FindControl("itemid");
            int          itemid   = int.Parse(k.Text);
            int          X        = int.Parse(Session["UserId"].ToString());
            string       unphewup = "DELETE FROM Phew WHERE NID = " + itemid + " AND UID = " + X + "";
            dbClass.DataBase(unphewup);

            LinkButton lk = (LinkButton)dataItem.FindControl("phew");
            //How Much
            DataTable dt        = new DataTable();
            string    getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
            dt             = dbClass.ReturnDT(getcvalue);
            lk.Text        = "Phew It!(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "phew";
        }
        else if (e.CommandName == "like")
        {
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label        k        = (Label)dataItem.FindControl("itemid");
            int          itemid   = int.Parse(k.Text);
            comment.Visible = false;
            int    z     = int.Parse(Session["UserID"].ToString());
            string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + itemid + ")";
            dbClass.DataBase(iphew);

            LinkButton lk = (LinkButton)dataItem.FindControl("like");

            //How Much..
            DataTable dt        = new DataTable();
            string    getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + "";
            dt             = dbClass.ReturnDT(getcvalue);
            lk.Text        = "Unlike(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "unlike";
        }
        else if (e.CommandName == "unlike")
        {
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label        k        = (Label)dataItem.FindControl("itemid");
            int          itemid   = int.Parse(k.Text);
            int          X        = int.Parse(Session["UserId"].ToString());
            string       unphewup = "DELETE FROM [Like] WHERE NID = " + itemid + " AND UID = " + X + "";
            dbClass.DataBase(unphewup);

            LinkButton lk = (LinkButton)dataItem.FindControl("like");
            //How Much
            DataTable dt        = new DataTable();
            string    getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + "";
            dt             = dbClass.ReturnDT(getcvalue);
            lk.Text        = "Like(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "like";
        }
    }
    protected void rg_contacts_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridNestedViewItem)
        {
            GridNestedViewItem nested_item  = (GridNestedViewItem)e.Item;
            HiddenField        hf_ctc_id    = (HiddenField)nested_item.FindControl("hf_ctc_id");
            ContactTemplate    ctc_template = (ContactTemplate)nested_item.FindControl("ctc_template");
            ctc_template.DuplicateLeadCheckingEnabled = this.DuplicateLeadCheckingEnabled;

            // Bind existing contacts
            String ContactID = hf_ctc_id.Value;
            ctc_template.BindContact(ContactID, IncludeContactTypes, TargetSystem, OnlyShowTargetSystemContactTypes, hf_user_id.Value);

            RadButton btn_update = (RadButton)nested_item.FindControl("btn_update");
            btn_update.ValidationGroup  = "vg_" + ContactID;
            btn_update.OnClientClicking = "function(button,args){ValidateContact('" + btn_update.ValidationGroup + "');}";

            RadButton btn_remove_dnc = (RadButton)nested_item.FindControl("btn_remove_dnc");
            btn_remove_dnc.Visible = ctc_template.HasKillWarning;
            RadButton btn_remove_estimated = (RadButton)nested_item.FindControl("btn_remove_estimated");
            btn_remove_estimated.Visible = ctc_template.IsEmailEstimated;
            RadButton btn_verifiy_email = (RadButton)nested_item.FindControl("btn_verifiy_email");
            btn_verifiy_email.Visible = false;// !ctc_template.IsEmailVerified && ctc_template.WorkEmail != String.Empty;
            RadButton btn_add_context = (RadButton)nested_item.FindControl("btn_add_context");
            btn_add_context.Visible = !OnlyShowContextualContacts;

            if (ctc_template.DontContactReason == "Already being Pursued by Someone Else")
            {
                btn_remove_dnc.Text = "Remove Being Pursued Notice";
            }
            else if (ctc_template.HasDoNotContact)
            {
                btn_remove_dnc.Text = "Remove Do-Not-Contact";
            }

            if (AllowKillingLeads)
            {
                // check to see if we allow kill of lead
                String    qry     = "SELECT GROUP_CONCAT(LeadID) as 'LeadID' FROM dbl_lead WHERE ProjectID IN (SELECT ProjectID FROM dbl_project WHERE UserID=@userid) AND Active=1 AND ContactID=@ctc_id";
                DataTable dt_lead = SQL.SelectDataTable(qry,
                                                        new String[] { "@userid", "@ctc_id" },
                                                        new Object[] { hf_user_id.Value, ContactID });
                if (dt_lead.Rows.Count > 0)
                {
                    String    LeadID   = dt_lead.Rows[0]["LeadID"].ToString(); // this is a group concat of Lead entries for this user, so will kill all active in current projects
                    RadButton btn_kill = (RadButton)nested_item.FindControl("btn_kill");
                    btn_kill.Visible          = true;
                    btn_kill.OnClientClicking = "function (button,args){ var rw = GetRadWindow(); var rwm = rw.get_windowManager(); setTimeout(function ()" +
                                                "{ rwm.open('multikill.aspx?lead_ids=" + Server.UrlEncode(LeadID) + "&kill_from_viewer=1', 'rw_kill_leads'); }, 0);}";
                }
            }

            // Disable invalid leads' checkboxes
            if (SelectableContacts)
            {
                ArrayList NewContactIDs            = (ArrayList)ViewState["NewContactIDs"];
                ArrayList ForcedSelectedContactIDs = (ArrayList)ViewState["ForcedSelectedContactIDs"];
                if (!ctc_template.IsValidContact || ForcedSelectedContactIDs.Count > 0 || NewContactIDs.Count > 0)
                {
                    foreach (GridDataItem item in rg_contacts.Items)
                    {
                        if (ContactID == item["ContactID"].Text)
                        {
                            if (NewContactIDs.Contains(ContactID))
                            {
                                ((CheckBox)item.FindControl("cb_select")).Checked = true;
                                break;
                            }
                            if (!ctc_template.IsValidContact)
                            {
                                ((CheckBox)item.FindControl("cb_select")).Enabled = false;
                                break;
                            }
                            else if (ForcedSelectedContactIDs.Contains(ContactID))
                            {
                                ((CheckBox)item.FindControl("cb_select")).Enabled = false;
                                ((CheckBox)item.FindControl("cb_select")).Checked = true;
                                ctc_template.SelectFirstContactTypeForTargetSystem(ContactID, TargetSystem);
                                break;
                            }
                        }
                    }
                }
            }
        }
        else if (e.Item is GridDataItem)
        {
            GridDataItem item   = (GridDataItem)e.Item;
            String       ctc_id = item["ContactID"].Text;

            // Completion indicator (based on company completion)
            int completion = 0;
            Int32.TryParse(item["Completion"].Text, out completion);
            item["Completion"].Text = String.Empty;
            String CssClass = "LowRatingCell HandCursor";
            if (completion >= 66)
            {
                CssClass = "HighRatingCell HandCursor";
            }
            else if (completion >= 33)
            {
                CssClass = "MediumRatingCell HandCursor";
            }
            item["Completion"].CssClass = CssClass;
            item["Completion"].ToolTip  = "Contact information is " + completion + "% complete.";

            ContactEmailManager ContactEmailManager = (ContactEmailManager)item["BEmailLink"].FindControl("ContactEmailManager");
            ContactEmailManager.ConfigureControl(true, "BindContactProxy", ctc_id);

            if (SelectableContacts)
            {
                // Don't Contact Reason
                if ((item["DontContactReason"].Text != "&nbsp;" && !item["DontContactReason"].Text.Contains("soft")) || item["DontContactUntil"].Text != "&nbsp;")
                {
                    item["Select"].ToolTip  = "Do-not-contact is set, expand for more details.";
                    item["Select"].CssClass = "DoNotContact HandCursor";
                }
                else
                {
                    item["Select"].CssClass = "HandCursor";
                }
            }
        }
    }
Example #19
0
        protected void rgEmploymentStatus_EditCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridDataItem item = (GridDataItem)e.Item;

            hdnName.Value = item["Status"].Text;
        }
Example #20
0
    protected void gvGuestBooking_ItemCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "UpdateRow")
            {
                hbtnRSN.Value = e.CommandArgument.ToString();
                if (e.Item is GridDataItem)
                {
                    GridDataItem ditem = (GridDataItem)e.Item;

                    LinkButton lnkRSN = (LinkButton)e.Item.FindControl("lnkRSN");

                    Session["RSN"] = lnkRSN.Text;

                    DataSet dsRes = sqlobj.ExecuteSP("SP_GuestBooking",
                                                     new SqlParameter()
                    {
                        ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = lnkRSN.Text
                    },
                                                     new SqlParameter()
                    {
                        ParameterName = "@IMode", SqlDbType = SqlDbType.BigInt, Value = 4
                    }
                                                     );

                    if (dsRes.Tables[0].Rows.Count > 0)
                    {
                        ddlBookingType.SelectedValue = dsRes.Tables[0].Rows[0]["BookingType"].ToString();

                        LoadBookingFor();

                        ddlBookingFor.SelectedValue = dsRes.Tables[0].Rows[0]["BookingFor"].ToString();


                        string sfromdate = dsRes.Tables[0].Rows[0]["FromDate"].ToString();
                        string stodate   = dsRes.Tables[0].Rows[0]["TillDate"].ToString();
                        // string safromdate = dsRes.Tables[0].Rows[0]["ActualFromDate"].ToString();
                        // string satodate = dsRes.Tables[0].Rows[0]["ActualTillDate"].ToString();

                        if (sfromdate != "")
                        {
                            dtpfromdate.SelectedDate = Convert.ToDateTime(dsRes.Tables[0].Rows[0]["FromDate"].ToString()).Date;
                        }

                        if (stodate != "")
                        {
                            dtptilldate.SelectedDate = Convert.ToDateTime(dsRes.Tables[0].Rows[0]["TillDate"].ToString()).Date;
                        }

                        txtName.Text             = dsRes.Tables[0].Rows[0]["Name"].ToString();
                        txtAddress.Text          = dsRes.Tables[0].Rows[0]["Address"].ToString();
                        txtMobileNo.Text         = dsRes.Tables[0].Rows[0]["MobileNo"].ToString();
                        txtEmailID.Text          = dsRes.Tables[0].Rows[0]["EmailID"].ToString();
                        ddlPurpose.SelectedValue = dsRes.Tables[0].Rows[0]["Purpose"].ToString();
                        txtRemarks.Text          = dsRes.Tables[0].Rows[0]["Remarks"].ToString();


                        if (ddlPurpose.SelectedValue == "Resident")
                        {
                            loadResident();

                            cmbResident.SelectedValue = dsRes.Tables[0].Rows[0]["RTRSN"].ToString();
                        }


                        ddlStatus.SelectedValue = dsRes.Tables[0].Rows[0]["Status"].ToString();


                        lblstatus.Visible = true;
                        ddlStatus.Visible = true;

                        string fromtime = dsRes.Tables[0].Rows[0]["CheckInTime"].ToString();
                        string totime   = dsRes.Tables[0].Rows[0]["CheckOutTime"].ToString();
                        // string afromtime = dsRes.Tables[0].Rows[0]["ACheckInTime"].ToString();
                        // string atotime = dsRes.Tables[0].Rows[0]["ACheckOutTime"].ToString();

                        if (fromtime != "")
                        {
                            dtpfromTime.SelectedDate = DateTime.Parse(dsRes.Tables[0].Rows[0]["CheckInTime"].ToString());
                        }
                        else
                        {
                            dtpfromTime.SelectedDate = null;
                        }


                        if (totime != "")
                        {
                            dtptoTime.SelectedDate = DateTime.Parse(dsRes.Tables[0].Rows[0]["CheckOutTime"].ToString());
                        }
                        else
                        {
                            dtptoTime.SelectedDate = null;
                        }

                        lnkaddnewtask.Text    = "Close";
                        lnkaddnewtask.ToolTip = "Click here to close.";
                        pnladdnewtask.Visible = true;


                        btnSave.Visible   = false;
                        btnUpdate.Visible = true;
                    }

                    dsRes.Dispose();
                }
            }
            else if (e.CommandName == "CheckIn")
            {
                Session["GBRSN"] = e.CommandArgument.ToString();

                if (e.Item is GridDataItem)
                {
                    GridDataItem ditem = (GridDataItem)e.Item;

                    string bdate = ditem["FromDate"].Text;

                    string[] fdate = bdate.Split(',');

                    DateTime fromdate = Convert.ToDateTime(fdate[1].ToString());
                    DateTime odbdate  = fromdate.AddDays(-1);

                    DateTime odadate = fromdate.AddDays(1);

                    DateTime sdate = DateTime.Now.Date;
                    //DateTime sdate = DateTime.ParseExact(DateTime.Now.Date.ToString(), "dd-MM-yyyy", CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);

                    if (sdate.Equals(fromdate) || sdate.Equals(odbdate) || sdate.Equals(odadate))
                    {
                        Response.Redirect("~/GuestChkInOut.aspx");
                    }
                }
            }
            else
            {
                LoadGuestBookingDetails();
            }
        }
        catch (Exception ex)
        {
            WebMsgBox.Show(ex.Message);
        }
    }
        private void EditRecord(GridDataItem gdItem)
        {
            int ID;
            ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["StaffID"]);
            string idStr = ID.ToString();

            DataTable dt = null;
            DataRow dr = null;

            dt = am.DataAccess.RecordSet("SELECT * FROM PCMember WHERE StaffID=@StaffID", new string[] { idStr });
            if (dt != null && dt.Rows.Count > 0)
            {
                dr = dt.Rows[0];
            }

            if (dr != null)
            {
                //Store Id
                hdfId.Value = idStr;

                cbxStaff.SelectedValue = dr["StaffID"].ToString().PadLeft(5, '0');
                chkActive.Checked = Convert.ToBoolean(dr["Active"]);

                //disable
                cbxStaff.Enabled = false;
            }
        }
        protected void RgvEmailConfig_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "imgbtndelete")
            {
                GridDataItem ditem = (GridDataItem)e.Item;
                e.Item.Selected = true;
                string  DeleteID = e.CommandArgument.ToString();
                Boolean result   = false;
                result = DataAccessManager.dELETEEmailConfig(DeleteID);
                if (result == true)
                {
                    RgvEmailConfig.Rebind();
                    Reset();
                    RlblEmailconfigResulut.Text      = string.Empty;
                    LRRlblEmailconfigResulut.Visible = false;
                    RPbtnSave.Text = "Save";
                }
            }

            if (e.CommandName == "imgbtnedit")
            {
                RlblEmailconfigResulut.Text      = string.Empty;
                LRRlblEmailconfigResulut.Visible = false;
                e.Item.Selected = true;
                GridDataItem ditem                = (GridDataItem)e.Item;
                Label        lbID                 = (Label)ditem.FindControl("lbID");
                Label        lbCampusID           = (Label)ditem.FindControl("lbCampusID");
                Label        lbDeptId             = (Label)ditem.FindControl("lbDeptId");
                Label        lbDeptEmail          = (Label)ditem.FindControl("lbDeptEmail");
                Label        lbPwd                = (Label)ditem.FindControl("lbPwd");
                Label        lbSMTP               = (Label)ditem.FindControl("lbSMTP");
                Label        lbPortOut            = (Label)ditem.FindControl("lbPortOut");
                Label        lbPop3               = (Label)ditem.FindControl("lbPop3");
                Label        lbPortIn             = (Label)ditem.FindControl("lbPortIn");
                Label        lbSSL                = (Label)ditem.FindControl("lbSSL");
                CheckBox     ItemChkboxActiveuser = (CheckBox)ditem.FindControl("ItemChkboxActiveuser");
                RPbtnSave.Text             = "Update";
                ViewState["emailconfigid"] = lbID.Text;
                Rddlcampus.SelectedValue   = Convert.ToString(lbCampusID.Text);
                //==============================================================
                string campusname = string.Empty;
                campusname = Convert.ToString(Rddlcampus.SelectedText);
                DepartmentBind(campusname);
                RddlDept.SelectedValue = Convert.ToString(lbDeptId.Text);
                //==============================================================
                RtxtDeptEmail.Text = Convert.ToString(lbDeptEmail.Text);
                RtxtPassword.Text  = Convert.ToString(lbPwd.Text);
                RtxtSMTP.Text      = Convert.ToString(lbSMTP.Text);
                RtxtPort.Text      = Convert.ToString(lbPortOut.Text);
                RtxtPOP3.Text      = Convert.ToString(lbPop3.Text);
                RtxtPortIn.Text    = Convert.ToString(lbPortIn.Text);

                string Checked = Convert.ToString(lbSSL.Text);
                if (Checked == "True")
                {
                    RbtnSSL.Checked = true;
                }
                else
                {
                    RbtnSSL.Checked = false;
                }
                if (ItemChkboxActiveuser.Checked == true)
                {
                    RbtnStatus.Checked = true;
                }
                else
                {
                    RbtnStatus.Checked = false;
                }
            }
        }
 private void adicionarArchivo(GridDataItem g)
 {
     Consulta c = new Consulta();
     ArchivoDependiente a = c.consultarArchivosDependientesOBJ(this.ddlTipoArchivo.SelectedValue, g.GetDataKeyValue("cod_archivo").ToString());
     if (a == null)
     {
         try
         {
             RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta();
             InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name));
             a = new ArchivoDependiente();
             a.archivo = c.consultarArchivoParametrizado(this.ddlTipoArchivo.SelectedValue);
             a.archivoDep = c.consultarArchivoParametrizado(g.GetDataKeyValue("cod_archivo").ToString());
             i.IUDarchivoDependiente(a, 2);
             cargarTabla2();
             this.RadWindowManager1.RadAlert("Archivo asociado correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
                 null, Utilities.pathImageMessage(TypeMessage.information_message));
         }
         catch (Exception ex)
         {
             Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex);
             this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.information_message),
                 null, Utilities.pathImageMessage(TypeMessage.error_message));
         }
     }
     else
     {
         this.RadWindowManager1.RadAlert("El archivo seleccionado ya se encuentra asociado", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
             null, Utilities.pathImageMessage(TypeMessage.information_message));
     }
 }
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.ProgScheduleService   proxyProgSchedule = new DayCareBAL.ProgScheduleService();
                DayCarePL.ProgScheduleProperties objProgSchedule   = new DayCarePL.ProgScheduleProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "SchoolProgram":
                                {
                                    objProgSchedule.SchoolProgramId = new Guid(ViewState["SchoolProgramId"].ToString());
                                    break;
                                }

                                case "Day":
                                {
                                    objProgSchedule.Day      = (item["Day"].Controls[1] as DropDownList).SelectedItem.ToString();
                                    objProgSchedule.DayIndex = Convert.ToInt32((item["Day"].Controls[1] as DropDownList).SelectedValue);
                                    break;
                                }

                                case "BeginTime":
                                {
                                    if ((e.Item.FindControl("rdBiginTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objProgSchedule.BeginTime = (e.Item.FindControl("rdBiginTp") as RadTimePicker).SelectedDate;
                                    }
                                    break;
                                }

                                case "CloseTime":
                                {
                                    if ((e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objProgSchedule.EndTime = (e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate;
                                    }
                                    break;
                                }

                                case "Active":
                                {
                                    objProgSchedule.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }

                                case "ProgClassRoom":
                                {
                                    objProgSchedule.ProgClassRoomId = new Guid((item["ProgClassRoom"].Controls[1] as DropDownList).SelectedValue);
                                    DayCareBAL.ProgClassRoomService proxyClassroom = new DayCareBAL.ProgClassRoomService();
                                    objProgSchedule.ClassRoomId = proxyClassroom.LoadProgClassRoom(new Guid(Session["SchoolId"].ToString()), new Guid(ViewState["SchoolProgramId"].ToString())).FirstOrDefault(u => u.Id.Equals(objProgSchedule.ProgClassRoomId)).ClassRoomId.Value;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (objProgSchedule.BeginTime != null && objProgSchedule.EndTime != null)
                    {
                        if (objProgSchedule.BeginTime > objProgSchedule.BeginTime)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Begin Time must be less than End Time.", "false"));
                            return(false);
                        }
                    }
                    else
                    {
                        MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Begin Time/End Time is not valid.", "false"));
                        return(false);
                    }



                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objProgSchedule.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objProgSchedule.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objProgSchedule.CreatedById      = new Guid(Session["StaffId"].ToString());
                            objProgSchedule.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    DropDownList ddlClassRoom = e.Item.FindControl("ddlProgClassRoom") as DropDownList;
                    if (ddlClassRoom.SelectedIndex == 0)
                    {
                        MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Select ClassRoom.", "false"));
                        return(false);
                    }
                    else
                    {
                        hdnName.Value = "";
                        DayCarePL.ProgScheduleProperties objCheck  = proxyProgSchedule.CheckDuplicateProgClassRoom(objProgSchedule.ClassRoomId, Convert.ToDateTime(objProgSchedule.BeginTime), Convert.ToDateTime(objProgSchedule.EndTime), Convert.ToInt32(objProgSchedule.DayIndex), objProgSchedule.Id);
                        DayCarePL.ProgScheduleProperties objResult = proxyProgSchedule.CheckBeginTimeAndEndTime(new Guid(Session["SchoolId"].ToString()), objProgSchedule.DayIndex, Convert.ToDateTime(objProgSchedule.BeginTime), Convert.ToDateTime(objProgSchedule.EndTime));
                        if (objResult == null)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "BeginTime And EndTime Does not Match  Hours Of Opration OpenTime And CloseTime", "false"));
                            return(false);
                        }
                        if (objCheck != null)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "" + objCheck.SchoolProgramTitle + " (program) already assigned to " + objCheck.ProgClassRoomTitle + " (class room) from " + Convert.ToDateTime(objCheck.BeginTime).ToShortTimeString() + "  to  " + Convert.ToDateTime(objCheck.EndTime).ToShortTimeString() + ".", "false"));
                            return(false);
                        }
                        else
                        {
                            result = proxyProgSchedule.Save(objProgSchedule);
                            if (result == true)
                            {
                                MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.HoursOfOperation, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
        private void DeleteAttachment(GridDataItem gdItem)
        {
            try
            {
                string folderPath = VSAttachmentfolderPath;
                string filepath = gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["FilePath"].ToString();
                am.DataAccess.BatchQuery.Delete("[dbo].[VendorSelectionAttach]", "[FilePath]=@FilePath", new string[]{folderPath + "/" + filepath});
                bool ret = am.DataAccess.BatchQuery.Execute();

                if (ret)
                {
                    String targetFolder = Server.MapPath(folderPath);
                    string path = Path.Combine(targetFolder, filepath);
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    LoadSelectionAttachment();
                }
            }
            catch (Exception ex)
            {

            }
        }
        protected void rgProgSchedule_EditCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridDataItem item = (GridDataItem)e.Item;

            hdnName.Value = item["Day"].Text;
        }
        private void DeleteRecord(GridDataItem gdItem)
        {
            int ID;

            ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["ProcessID"]);
            am.DataAccess.BatchQuery.Delete("Process", "ProcessID=@ProcessID", new string[] { ID.ToString() });
            if (am.DataAccess.BatchQuery.Execute())
            {
                hdfId.Value = "0";
                grd.Rebind();
                ResetRecord(false);
                am.Utility.ShowHTMLAlert(this.Page, "000", AppUtility.SUCCESSFUL_DELETE_MSG.Replace(AppUtility.MESSAGING_REPLACE_TAG, pagename));
            }
        }
        protected void rdGridDocLitigio_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                DataRowView  row  = (DataRowView)e.Item.DataItem;

                if (!string.IsNullOrEmpty(Decimales))
                {
                    if (int.Parse(Decimales) > 0)
                    {
                        if ((!string.IsNullOrEmpty(item["Saldo"].Text)) && (item["Saldo"].Text != "&nbsp;"))
                        {
                            item["Saldo"].Text = double.Parse(row["Saldo"].ToString()).ToString("N" + Decimales);
                        }

                        if ((!string.IsNullOrEmpty(item["MontoLitigio"].Text)) && (item["MontoLitigio"].Text != "&nbsp;"))
                        {
                            item["MontoLitigio"].Text = double.Parse(row["MontoLitigio"].ToString()).ToString("N" + Decimales);
                        }

                        if ((!string.IsNullOrEmpty(item["montoNC"].Text)) && (item["montoNC"].Text != "&nbsp;"))
                        {
                            item["montoNC"].Text = double.Parse(row["montoNC"].ToString()).ToString("N" + Decimales);
                        }
                    }
                    else
                    {
                        if ((!string.IsNullOrEmpty(item["Saldo"].Text)) && (item["Saldo"].Text != "&nbsp;"))
                        {
                            item["Saldo"].Text = double.Parse(row["Saldo"].ToString()).ToString("N0");
                        }

                        if ((!string.IsNullOrEmpty(item["MontoLitigio"].Text)) && (item["MontoLitigio"].Text != "&nbsp;"))
                        {
                            item["MontoLitigio"].Text = double.Parse(row["MontoLitigio"].ToString()).ToString("N0");
                        }

                        if ((!string.IsNullOrEmpty(item["montoNC"].Text)) && (item["montoNC"].Text != "&nbsp;"))
                        {
                            item["montoNC"].Text = double.Parse(row["montoNC"].ToString()).ToString("N0");
                        }
                    }
                }
                else
                {
                    if ((!string.IsNullOrEmpty(item["Saldo"].Text)) && (item["Saldo"].Text != "&nbsp;"))
                    {
                        item["Saldo"].Text = double.Parse(row["Saldo"].ToString()).ToString("N0");
                    }

                    if ((!string.IsNullOrEmpty(item["MontoLitigio"].Text)) && (item["MontoLitigio"].Text != "&nbsp;"))
                    {
                        item["MontoLitigio"].Text = double.Parse(row["MontoLitigio"].ToString()).ToString("N0");
                    }

                    if ((!string.IsNullOrEmpty(item["montoNC"].Text)) && (item["montoNC"].Text != "&nbsp;"))
                    {
                        item["montoNC"].Text = double.Parse(row["montoNC"].ToString()).ToString("N0");
                    }
                }
            }
        }
Example #29
0
 //Selects the items down in the hierarchy
 private void SelectChildTableItems(GridDataItem dataItem)
 {
     dataItem.Expanded = ExpandedRows.Contains(dataItem.GetDataKeyValue(dataItem.OwnerTableView.DataKeyNames[0]).ToString());
     //If the item is expanded selects the child items if it is not the expanded the items should not be selected
     if (dataItem.Expanded)
     {
         GridTableView nestedTableView = dataItem.ChildItem.NestedTableViews[0];
         this.SelectItems(TableViews[nestedTableView.Name], nestedTableView.Items, null);
     }
 }
        protected void rgStaffCategory_EditCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridDataItem item = (GridDataItem)e.Item;

            hdnName.Value = item["Name"].Text;
        }
Example #31
0
        protected void rgCvrg_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
            {
                dvManage.Visible = false;
                if (e.Item.Expanded)
                {
                    if (e.Item is GridDataItem)
                    {
                        GridDataItem item = e.Item as GridDataItem;

                        item.Expanded = false;
                        DrawGrid();
                        return;
                    }
                }

                int  iopen    = -1;
                bool boolstop = false;
                foreach (GridDataItem dataItem in rgCvrg.MasterTableView.Items)
                {
                    if (!boolstop)
                    {
                        iopen++;
                    }
                    if (dataItem.Expanded)
                    {
                        boolstop          = true;
                        dataItem.Expanded = false;
                    }
                }



                //if (iopen.Equals(e.Item.ItemIndex))
                //    return;

                if (e.Item is GridDataItem)
                {
                    GridDataItem item = e.Item as GridDataItem;

                    string strID = item.GetDataKeyValue("record_id").ToString();
                    ViewState["cvrhID"] = strID;
                }

                string hid2 = e.Item.ItemIndex.ToString();

                rgCvrg.MasterTableView.Items[Convert.ToInt32(e.Item.ItemIndex.ToString())].Selected = true; //.GetDataKeyValue(.DataKeyValues[0].ToString();

                int SelValue = Convert.ToInt32(rgCvrg.SelectedValue.ToString());

                int index1 = Convert.ToInt32(hid2.ToString());

                ProcessAction(true);

                DataTable tblStatus = Data.RateStatus(ViewState["accnt"].ToString(), ViewState["verion"].ToString(), ViewState["class_code"].ToString(), ViewState["category_code"].ToString(),
                                                      ViewState["category_plan"].ToString(), ViewState["py"].ToString(), ViewState["batch"].ToString());

                string strStatus = tblStatus.Rows[0]["status"].ToString();

                if (strStatus.Equals("R"))
                {
                    ((RadGrid)rgCvrg.MasterTableView.Items[index1].ChildItem.FindControl("rgRate")).Skin = "Sunset";
                }
                else if (strStatus.Equals("A"))
                {
                    ((RadGrid)rgCvrg.MasterTableView.Items[index1].ChildItem.FindControl("rgRate")).Skin = "Windows7";
                }


                DataTable tbl = Data.GetRates(ViewState["accnt"].ToString(), ViewState["verion"].ToString(), ViewState["class_code"].ToString(), ViewState["category_code"].ToString(),
                                              ViewState["category_plan"].ToString(), ViewState["py"].ToString(), ViewState["batch"].ToString());

                ((RadGrid)rgCvrg.MasterTableView.Items[index1].ChildItem.FindControl("rgRate")).DataSource = tbl;
                ((RadGrid)rgCvrg.MasterTableView.Items[index1].ChildItem.FindControl("rgRate")).DataBind();
            }
        }
Example #32
0
    protected void rdgResidentDet_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        try
        {
            GridDataItem itm = e.Item as GridDataItem;
            if (itm != null)
            {
                if (itm.Cells[12].Text.Equals("Y"))
                {
                    LinkButton linkBtn = (LinkButton)itm.Cells[3].FindControl("lnkDoor");
                    linkBtn.ForeColor = System.Drawing.Color.Maroon;
                    linkBtn.Font.Bold = true;

                    //itm.Cells[3].ForeColor = System.Drawing.Color.Maroon;
                    //itm.Cells[3].Font.Bold = true;
                }
                if (itm.Cells[11].Text.Equals("Y"))
                {
                    itm.Cells[5].ForeColor = System.Drawing.Color.Maroon;
                    itm.Cells[5].Font.Bold = true;
                }
                if (itm.Cells[13].Text.Equals("Y"))
                {
                    itm.Cells[5].BackColor = System.Drawing.Color.Yellow;
                    itm.Cells[5].Font.Bold = true;
                }

                if (itm.Cells[17].Text.Equals("Y"))
                {
                    //itm.Cells[7].Text = "Overdue";
                    itm.Cells[7].ForeColor = System.Drawing.Color.Maroon;
                    itm.Cells[7].Font.Bold = true;
                }


                if (itm.Cells[15].Text.Equals("Y"))
                {
                    //itm.Cells[8].Text = "Overdue";
                    itm.Cells[8].ForeColor = System.Drawing.Color.Maroon;
                    itm.Cells[8].Font.Bold = true;
                }



                //Control ctrl = e.Item.FindControl("lblHK");
                //e.Item.FindControl("lblHK") = "Ram";

                //GridHeaderItem item = (GridHeaderItem)e.Item;
                //Label lbl = (Label)item.FindControl("lblHK");
                //lbl.Text = "Ram";

                //if (e.Item.ItemType == ListItemType.Header)
                //{


                //}


                //else
                //{
                //    //itm.Cells[6].BackColor = System.Drawing.Color.LightSkyBlue;
                //    itm.Cells[6].ForeColor = System.Drawing.Color.Black;
                //}

                //LinkButton lnkInvoice = (LinkButton)itm.Cells[3].FindControl("BtnInvoice");
                //if (!itm.Cells[10].Text.Equals("&nbsp;") && itm.Cells[10].Text.Equals("DONE"))
                //{
                //    itm.Cells[10].BackColor = System.Drawing.Color.Green;
                //    itm.Cells[10].ForeColor = System.Drawing.Color.White;
                //    lnkInvoice.Visible = false;
                //}
                //else if (!itm.Cells[10].Text.Equals("&nbsp;") && (itm.Cells[10].Text.Equals("OPEN") || itm.Cells[10].Text.Equals("PART")))
                //{
                //    itm.Cells[10].BackColor = System.Drawing.Color.Yellow;
                //    itm.Cells[10].ForeColor = System.Drawing.Color.Black;
                //    lnkInvoice.Visible = true;
                //}
                //else
                //{
                //    itm.Cells[10].BackColor = System.Drawing.Color.OrangeRed;
                //    itm.Cells[10].ForeColor = System.Drawing.Color.White;
                //    lnkInvoice.Visible = false;
                //}



                //LinkButton BtnInvRef1 = (LinkButton)itm.Cells[13].FindControl("BtnInvRef1");
                //String[] InvRef = BtnInvRef1.Text.ToString().Replace(",,", ",").Split(',');
                ////ShowMessage(InvRef.Length.ToString(),"Alert");
                //if (InvRef.Length >= 1)
                //{
                //    BtnInvRef1.Text = InvRef[0].ToString();
                //    if (InvRef.Length >= 2)
                //    {

                //        LinkButton BtnInvRef2 = (LinkButton)itm.Cells[13].FindControl("BtnInvRef2");
                //        BtnInvRef2.Text = InvRef[1].ToString();
                //        BtnInvRef2.Visible = true;
                //    }
                //    if (InvRef.Length >= 3)
                //    {

                //        LinkButton BtnInvRef3 = (LinkButton)itm.Cells[13].FindControl("BtnInvRef3");
                //        BtnInvRef3.Text = InvRef[2].ToString();
                //        BtnInvRef3.Visible = true;
                //    }
                //    if (InvRef.Length >= 4)
                //    {
                //        LinkButton BtnInvRef4 = (LinkButton)itm.Cells[13].FindControl("BtnInvRef4");
                //        BtnInvRef4.Text = InvRef[3].ToString();
                //        BtnInvRef4.Visible = true;
                //    }
                //    if (InvRef.Length >= 5)
                //    {
                //        LinkButton BtnInvRef5 = (LinkButton)itm.Cells[13].FindControl("BtnInvRef5");
                //        BtnInvRef5.Text = InvRef[4].ToString();
                //        BtnInvRef5.Visible = true;
                //    }
                //}
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void gvVilla_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "UpdateRow")
        {
            hbtnRSN.Value = e.CommandArgument.ToString();
            if (e.Item is GridDataItem)
            {
                GridDataItem ditem     = (GridDataItem)e.Item;
                LinkButton   lnkdoorno = (LinkButton)e.Item.FindControl("lbtnDoorNo");
                DataSet      dsRes     = sqlobj.ExecuteSP("Proc_VillaMaster",
                                                          new SqlParameter()
                {
                    ParameterName = "@i", SqlDbType = SqlDbType.Int, Value = 6
                },
                                                          new SqlParameter()
                {
                    ParameterName = "@DoorNo", SqlDbType = SqlDbType.NVarChar, Value = lnkdoorno.Text
                });
                if (dsRes.Tables[0].Rows.Count > 0)
                {
                    txtDoorno.Text = dsRes.Tables[0].Rows[0]["DoorNo"].ToString();
                    if (txtDoorno.Text == "STAFF" || txtDoorno.Text == "WALKIN" || txtDoorno.Text == "")
                    {
                        txtDoorno.Enabled = false;
                    }
                    ddlType.SelectedValue   = dsRes.Tables[0].Rows[0]["Type"].ToString();
                    ddlFloors.SelectedValue = dsRes.Tables[0].Rows[0]["Floor"].ToString();
                    txtdesc.Text            = dsRes.Tables[0].Rows[0]["Description"].ToString();
                    if (dsRes.Tables[0].Rows[0]["ConstructionYear"].ToString() == "0")
                    {
                        txtConstructionYear.Text = "";
                    }
                    else
                    {
                        txtConstructionYear.Text = dsRes.Tables[0].Rows[0]["ConstructionYear"].ToString();
                    }

                    txtBlockName.Text       = dsRes.Tables[0].Rows[0]["BlockName"].ToString();
                    ddlStatus.SelectedValue = dsRes.Tables[0].Rows[0]["status"].ToString();
                    txtcstatus.Text         = dsRes.Tables[0].Rows[0]["status"].ToString();
                    strPstatus    = dsRes.Tables[0].Rows[0]["status"].ToString();
                    txtSqure.Text = dsRes.Tables[0].Rows[0]["SqrFeet"].ToString();
                    //txtcstatus.Visible = true;
                    ddlStatus.Visible = true;
                    //btnSave.Visible = true;
                    //lblnewstatus.Visible = true;
                    //txtNewStatus.Visible = true;
                }
                btnSave.Visible = false;
                //btnDelete.Visible = true;
                btnUpdate.Visible = true;
            }
        }
        else if (e.CommandName == "ViewDetails")
        {
            DataSet dsRes = new DataSet();

            dsRes = sqlobj.ExecuteSP("Proc_GetResidents",
                                     new SqlParameter()
            {
                ParameterName = "@DoorNo", SqlDbType = SqlDbType.NVarChar, Value = e.CommandArgument.ToString()
            });


            if (dsRes.Tables[0].Rows.Count > 0)
            {
                dlDoorno.DataSource = dsRes;
                dlDoorno.DataBind();
                rwDetailsPopup.Visible = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert", "alert('No resident available');", true);
            }
        }
        else if (e.CommandName == "ViewHistory")
        {
            string DoorNo = e.CommandArgument.ToString();
            LblDoorNo.Text     = "Occupancy History for " + DoorNo;
            Session["RDoorNo"] = DoorNo;
            LoadOccupancyHistory(DoorNo);
            rwOccupancyHistory.Visible = true;
        }
        else
        {
            LoadUserGrid();
        }
    }
Example #34
0
        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "phew")
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                Label        k        = (Label)dataItem.FindControl("hell");
                LinkButton   lk       = (LinkButton)dataItem.FindControl("phew");
                string       wtf      = k.Text;
                int          z        = int.Parse(Session["UserID"].ToString());
                if (wtf.StartsWith("album"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "INSERT INTO PhewAlbums (UID , AID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unphew(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unphew";
                    // return "album" + dRView["AlID"].ToString();
                }
                else if (wtf.StartsWith("photo"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "INSERT INTO PhewPhotos (UID , PID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unphew(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unphew";
                    // return "photo" + dRView["AlID"].ToString();
                }
                else
                {
                    int    detid = int.Parse(wtf.Substring(7));
                    string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unphew(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unphew";
                    //  return "usual comment" + dRView["P"].ToString();
                }

                // int itemid = int.Parse(k.Text);

                /* int z = int.Parse(Session["UserID"].ToString());
                 * string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + itemid + ")";
                 * dbClass.DataBase(iphew);
                 *
                 * LinkButton lk = (LinkButton)dataItem.FindControl("phew");
                 *
                 * //How Much..
                 * DataTable dt = new DataTable();
                 * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
                 * dt = dbClass.ReturnDT(getcvalue);
                 * lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")";
                 * lk.CommandName = "unphew";*/
            }
            else if (e.CommandName == "unphew")
            {
                // DELETE FROM Persons
                //WHERE LastName='Tjessem' AND FirstName='Jakob'
                GridDataItem dataItem = (GridDataItem)e.Item;
                Label        k        = (Label)dataItem.FindControl("hell");
                LinkButton   lk       = (LinkButton)dataItem.FindControl("phew");
                string       wtf      = k.Text;
                int          z        = int.Parse(Session["UserID"].ToString());
                if (wtf.StartsWith("album"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "DELETE FROM PhewAlbums WHERE UID = " + z + " AND  AID = " + detid + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "phew it!(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "phew";
                    // return "album" + dRView["AlID"].ToString();
                }
                else if (wtf.StartsWith("photo"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "DELETE FROM PhewPhotos WHERE UID = " + z + " AND  PID = " + detid + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "phew it!(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "phew";
                    // return "photo" + dRView["AlID"].ToString();
                }
                else
                {
                    int    detid = int.Parse(wtf.Substring(7));
                    string iphew = "DELETE FROM Phew WHERE UID = " + z + " AND  NID = " + detid + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "phew it!(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "phew";
                    //  r
                }

                /*int itemid = int.Parse(k.Text);
                 * int X = int.Parse(Session["UserId"].ToString());
                 * string unphewup = "DELETE FROM Phew WHERE NID = " + itemid + " AND UID = " + X + "";
                 * dbClass.DataBase(unphewup);
                 *
                 * LinkButton lk = (LinkButton)dataItem.FindControl("phew");
                 * //How Much
                 * DataTable dt = new DataTable();
                 * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
                 * dt = dbClass.ReturnDT(getcvalue);
                 * lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")";
                 * lk.CommandName = "phew";
                 *
                 */
            }
            else if (e.CommandName == "like")
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                Label        k        = (Label)dataItem.FindControl("hell");
                LinkButton   lk       = (LinkButton)dataItem.FindControl("like");
                string       wtf      = k.Text;
                int          z        = int.Parse(Session["UserID"].ToString());
                if (wtf.StartsWith("album"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "INSERT INTO [LikeAlbums] (UID , AID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unlike(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unlike";
                    // return "album" + dRView["AlID"].ToString();
                }
                else if (wtf.StartsWith("photo"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "INSERT INTO [LikePhotos] (UID , PID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unlike(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unlike";
                    // return "photo" + dRView["AlID"].ToString();
                }
                else
                {
                    int    detid = int.Parse(wtf.Substring(7));
                    string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + detid + ")";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "unlike(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "unlike";
                    //  r
                }



                /*int itemid = int.Parse(k.Text);
                 *
                 * int z = int.Parse(Session["UserID"].ToString());
                 * string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + itemid + ")";
                 * dbClass.DataBase(iphew);
                 *
                 * LinkButton lk = (LinkButton)dataItem.FindControl("like");
                 *
                 * //How Much..
                 * DataTable dt = new DataTable();
                 * string getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + "";
                 * dt = dbClass.ReturnDT(getcvalue);
                 * lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")";
                 * lk.CommandName = "unlike";*/
            }
            else if (e.CommandName == "unlike")
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                Label        k        = (Label)dataItem.FindControl("hell");
                LinkButton   lk       = (LinkButton)dataItem.FindControl("like");
                string       wtf      = k.Text;
                int          z        = int.Parse(Session["UserID"].ToString());
                if (wtf.StartsWith("album"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "DELETE FROM [LikeAlbums] WHERE AID = " + detid + " AND UID = " + z + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "like(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "like";
                    // return "album" + dRView["AlID"].ToString();
                }
                else if (wtf.StartsWith("photo"))
                {
                    int    detid = int.Parse(wtf.Substring(5));
                    string iphew = "DELETE FROM [LikePhotos] WHERE PID = " + detid + " AND UID = " + z + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "like(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "like";
                    // return "photo" + dRView["AlID"].ToString();
                }
                else
                {
                    int    detid = int.Parse(wtf.Substring(7));
                    string iphew = "DELETE FROM [Like] WHERE NID = " + detid + " AND UID = " + z + "";
                    dbClass.DataBase(iphew);
                    //How Much
                    DataTable dt        = new DataTable();
                    string    getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + "";
                    dt             = dbClass.ReturnDT(getcvalue);
                    lk.Text        = "like(" + dt.Rows.Count.ToString() + ")";
                    lk.CommandName = "like";
                    //  r
                }

                if (e.CommandName == "Sort" || e.CommandName == "Page")
                {
                    RadToolTipManager1.TargetControls.Clear();
                }
            }
        }
        protected void grdRequest_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Select")
                {
                    BtnInsert.Enabled = false;
                    BtnUpdate.Enabled = true;


                    GridDataItem dataitem = e.Item as GridDataItem;

                    DataTable dtcon = CM_Main.SelectJob("CASE3", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    grdRequest.DataSource = dtcon;
                    grdRequest.DataBind();

                    lblID.Text           = dtcon.Rows[0]["REQUEST_ID"].ToString();
                    lblParentChange.Text = dtcon.Rows[0]["PARENT_ID"].ToString();
                    lblWorkFlowID.Text   = dtcon.Rows[0]["IT_REQUEST_ID"].ToString();
                    lblCompany.Text      = dtcon.Rows[0]["COMPANY"].ToString();
                    txtStatus.Text       = dtcon.Rows[0]["STATUS"].ToString();
                    txtTitle.Text        = dtcon.Rows[0]["TITLE"].ToString();
                    lblSystem.Text       = dtcon.Rows[0]["SYSTEM"].ToString();
                    txtDesciption.Text   = dtcon.Rows[0]["DESCRIPTION"].ToString();


                    RdGrdContacts.DataSource = CM_Main.SelectJob("CASE6", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    RdGrdContacts.DataBind();

                    RdGrdCIPath.DataSource = CM_Main.SelectJob("CASE7", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    RdGrdCIPath.DataBind();

                    RdGrdChildChanges.DataSource = CM_Main.SelectJob("CASE8", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    RdGrdChildChanges.DataBind();


                    DataList1.DataSource = CM_Main.SelectJob("CASE9", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    DataList1.DataBind();

                    RdGrdEvents.DataSource = CM_Main.SelectJob("CASE10", dataitem["REQUEST_ID"].Text, "", "", "", "", System.DateTime.Now);
                    RdGrdEvents.DataBind();


                    DataTable dtEvents = Main.SelectJobFromRegister("CASE16", lblWorkFlowID.Text, "", "", System.DateTime.Now);
                    RadGrdEventsITWF.DataSource = dtEvents;
                    RadGrdEventsITWF.DataBind();

                    DataTable dt = Main.SelectImages(lblWorkFlowID.Text, "BRANCH_IMAGE");
                    galleryDataList.DataSource = dt;
                    galleryDataList.DataBind();

                    DataTable dt33 = Main.SelectImages(lblWorkFlowID.Text, "BRANCH_DOCS");
                    DataList2.DataSource = dt33;
                    DataList2.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text    = ex.Message;
                lblError.Visible = true;
                return;
            }
        }
        protected void grdAgentSearch_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Select")
                {
                    Session["TableRecords"] = null;
                    GridDataItem dataitem = e.Item as GridDataItem;
                    DataTable    dt1      = com.SelectAgentHierarchyData("CASE1", dataitem["PARENT_CODE"].Text, "", "");

                    txtAgentCode.Text = dataitem["AGENT_CODE"].Text;

                    grdAgentParent.DataSource = dt1;
                    grdAgentParent.DataBind();

                    Session["TableRecords"] = dt1;

                    //DataTable table = new DataTable();
                    //table.Columns.Add("AGENTID", typeof(string));
                    //table.Columns.Add("AGENT_CODE", typeof(string));
                    //table.Columns.Add("AGENT_NAME", typeof(string));
                    //table.Columns.Add("PARENT_CODE", typeof(string));
                    //table.Columns.Add("COMMISSION", typeof(string));
                    //table.Columns.Add("AGENT_LEVEL", typeof(string));

                    //if (dt1.Rows.Count > 0)
                    //{
                    //    table.Rows.Add(dt1.Rows[0]["AGENTID"].ToString(),
                    //                  dt1.Rows[0]["AGENT_CODE"].ToString(),
                    //                  dt1.Rows[0]["AGENT_NAME"].ToString(),
                    //                  dt1.Rows[0]["PARENT_CODE"].ToString(),
                    //                  dt1.Rows[0]["COMMISSION"].ToString(),
                    //                  dt1.Rows[0]["AGENT_LEVEL"].ToString()
                    //                  );

                    //    DataTable dt2 = com.SelectAgentData("CASE1", dt1.Rows[0]["PARENT_CODE"].ToString(), "", "");
                    //    if (dt2.Rows.Count > 0)
                    //    {
                    //        table.Rows.Add(dt2.Rows[0]["AGENTID"].ToString(),
                    //                       dt2.Rows[0]["AGENT_CODE"].ToString(),
                    //                       dt2.Rows[0]["AGENT_NAME"].ToString(),
                    //                       dt2.Rows[0]["PARENT_CODE"].ToString(),
                    //                       dt2.Rows[0]["COMMISSION"].ToString(),
                    //                       dt2.Rows[0]["AGENT_LEVEL"].ToString()
                    //     );

                    //    }

                    //grdAgentParent.DataSource = table;
                    //grdAgentParent.DataBind();
                    //  }
                    //else
                    //{
                    //    grdAgentParent.DataSource = new int[] { };
                    //}
                }
            }
            catch (Exception ex)
            {
                lblError.Text    = ex.Message;
                lblError.Visible = true;
                return;
            }
        }
Example #37
0
    protected void LnkbtnCaseID_Click(object sender, EventArgs e)
    {
        try
        {
            SqlProcsNew sqlobj = new SqlProcsNew();
            if (CnfResult.Value == "true")
            {
                string       CaseID, FileName;
                LinkButton   lnkBtnCaseID = (LinkButton)sender;
                GridDataItem row          = (GridDataItem)lnkBtnCaseID.NamingContainer;

                CaseID   = row.Cells[3].Text.ToString();
                FileName = row.Cells[12].Text.ToString();

                DataSet ds = new DataSet();
                ds = sqlobj.ExecuteSP("SP_SecCheckUser",
                                      new SqlParameter()
                {
                    ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 6
                },
                                      new SqlParameter()
                {
                    ParameterName = "@CaseID", SqlDbType = SqlDbType.NVarChar, Value = CaseID
                });

                if (ds.Tables[0].Rows.Count > 0)
                {
                    sqlobj.ExecuteSQLNonQuery("SP_SecUpdateCaseID",
                                              new SqlParameter()
                    {
                        ParameterName = "@iMode", SqlDbType = SqlDbType.Int, Value = 1
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = Session["UserId"].ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@CaseId", SqlDbType = SqlDbType.NVarChar, Value = CaseID
                    });

                    DownloadFile(FileName);

                    //LoadAssigned();

                    //Panel1.Visible = false;
                    //Panel2.Visible = true;



                    //Response.Redirect("PreviewLevelS.aspx");

                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "onload", "javascript:location.reload(true);", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Already Selected');", true);
                    //Response.Redirect(Request.RawUrl, false);
                }
            }
        }
        catch (Exception ex)
        {
            //WebMsgBox.Show(ex.Message.ToString());
        }
        finally
        {
            ////Sends the response buffer
            //HttpContext.Current.Response.Flush();
            //// Prevents any other content from being sent to the browser
            //HttpContext.Current.Response.SuppressContent = true;
            ////Directs the thread to finish, bypassing additional processing
            //HttpContext.Current.ApplicationInstance.CompleteRequest();
            ////Suspends the current thread
            ////Thread.Sleep(1);
        }
    }
Example #38
0
 protected void honorariumGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         GridDataItem item = e.Item as GridDataItem;
         Session["hrID"] = item["id"].Text;
         Response.Redirect("/Financials/EditHonorarium.aspx");
     }
     if (e.CommandName == "Approve")
     {
         GridDataItem item       = e.Item as GridDataItem;
         DateTime     paydate    = Convert.ToDateTime(item["Paydate"].Text);
         string       payname    = item["GuestName"].Text;
         double       hrAmount   = Convert.ToDouble(item["hrAmount"].Text);
         string       hrCurrency = item["hrCurrency"].Text;
         double       lgAmount   = Convert.ToDouble(item["lgAmount"].Text);
         string       lgCurrency = item["lgCurrency"].Text;
         string       remarks    = item["Remarks"].Text;
         string       query      = "update Honorarium set Approved = '1' where id = '" + item["id"].Text + "'";
         command = new SqlCommand(query, connection);
         try
         {
             if (connection.State == ConnectionState.Closed)
             {
                 connection.Open();
             }
             rows = command.ExecuteNonQuery();
             if (rows == 1)
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.success('Record Approved Successfully', 'Success');", true);
                 honorariumGrid.Rebind();
                 command.Dispose();
                 //save grandtotal as income in payments
                 if (hrAmount > 0.0)
                 {
                     query   = "insert into Payments(paydate,payname,description,paytype,paymode,currency,amount,paybank,chequeno,valuedate,remarks,preparedby) ";
                     query  += "values(@paydate,@payname,@description,@paytype,@paymode,@currency,@amount,@paybank,@chequeno,@valuedate,@remarks,@preparedby)";
                     command = new SqlCommand(query, connection);
                     command.Parameters.Add("@paydate", SqlDbType.Date).Value        = paydate;
                     command.Parameters.Add("@payname", SqlDbType.VarChar).Value     = payname;
                     command.Parameters.Add("@description", SqlDbType.VarChar).Value = "Honorarium";
                     command.Parameters.Add("@paytype", SqlDbType.VarChar).Value     = "Expense";
                     command.Parameters.Add("@paymode", SqlDbType.VarChar).Value     = "Cash";
                     command.Parameters.Add("@currency", SqlDbType.VarChar).Value    = hrCurrency;
                     command.Parameters.Add("@amount", SqlDbType.VarChar).Value      = hrAmount;
                     command.Parameters.Add("@paybank", SqlDbType.VarChar).Value     = "";
                     command.Parameters.Add("@chequeno", SqlDbType.VarChar).Value    = "";
                     command.Parameters.Add("@valuedate", SqlDbType.Date).Value      = DateTime.UtcNow;
                     command.Parameters.Add("@remarks", SqlDbType.VarChar).Value     = remarks;
                     command.Parameters.Add("@preparedby", SqlDbType.VarChar).Value  = Context.User.Identity.Name;
                     rows += command.ExecuteNonQuery();
                     command.Dispose();
                 }
                 if (lgAmount > 0.0)
                 {
                     //query = "insert into Payments(paydate,payname,description,paytype,paymode,amount,paybank,chequeno,valuedate,remarks,preparedby) ";
                     //query += "values(@paydate,@payname,@description,@paytype,@paymode,@amount,@paybank,@chequeno,@valuedate,@remarks,@preparedby)";
                     command = new SqlCommand(query, connection);
                     command.Parameters.Add("@paydate", SqlDbType.Date).Value        = paydate;
                     command.Parameters.Add("@payname", SqlDbType.VarChar).Value     = payname;
                     command.Parameters.Add("@description", SqlDbType.VarChar).Value = "Honorarium(Lodging)";
                     command.Parameters.Add("@paytype", SqlDbType.VarChar).Value     = "Expense";
                     command.Parameters.Add("@paymode", SqlDbType.VarChar).Value     = "Cash";
                     command.Parameters.Add("@currency", SqlDbType.VarChar).Value    = lgCurrency;
                     command.Parameters.Add("@amount", SqlDbType.VarChar).Value      = lgAmount;
                     command.Parameters.Add("@paybank", SqlDbType.VarChar).Value     = "";
                     command.Parameters.Add("@chequeno", SqlDbType.VarChar).Value    = "";
                     command.Parameters.Add("@valuedate", SqlDbType.Date).Value      = DateTime.UtcNow;
                     command.Parameters.Add("@remarks", SqlDbType.VarChar).Value     = remarks;
                     command.Parameters.Add("@preparedby", SqlDbType.VarChar).Value  = Context.User.Identity.Name;
                     rows += command.ExecuteNonQuery();
                     command.Dispose();
                 }
                 if (rows > 1)
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "paid", "toastr.success('Posted to Payments Successfully', 'Success');", true);
                 }
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.error('" + ex.Message.Replace("'", "").Replace("\r\n", "") + "', 'Error');", true);
         }
         finally
         {
             connection.Close();
         }
     }
 }
Example #39
0
        /// <summary>
        /// Handles the ItemDataBound event of the gvTasks control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridItemEventArgs"/> instance containing the event data.</param>
        protected void gvTasks_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.EditItem || e.Item is GridDataItem)
            {
                GridDataItem  dataItem      = (GridDataItem)e.Item;
                ItemBriefTask itemBriefTask = ((dynamic)(dataItem.DataItem)).ItemBriefTask;

                CheckBox  chkStatus     = (CheckBox)dataItem.FindControl("chkStatus");
                HyperLink hyperLinkItem = (HyperLink)dataItem.FindControl("hyperLinkItem");

                if (hyperLinkItem != null)
                {
                    hyperLinkItem.NavigateUrl = ResolveUrl(string.Format("~/ItemBrief/ItemBriefDetails.aspx?ItemBriefId={0}", itemBriefTask.ItemBriefId));
                    hyperLinkItem.Text        = Support.TruncateString(itemBriefTask.ItemBrief.Name, 15);
                }

                if (IsReadOnlyRightsForProject)
                {
                    chkStatus.Enabled = false;
                }

                if (chkStatus != null)
                {
                    if (itemBriefTask.ItemBriefTaskStatusCodeId == codeComplete.CodeId)
                    {
                        chkStatus.Checked = true;
                        chkStatus.Enabled = false;
                    }
                    chkStatus.ToolTip = SetTooltipForStatus(chkStatus.Checked);
                }

                if (e.Item.ItemType == GridItemType.EditItem)
                {
                    TextBox           txtDescription = (TextBox)dataItem.FindControl("tbDescription");
                    TextBox           txtVendor      = (TextBox)dataItem.FindControl("tbVendor");
                    RadNumericTextBox tbNetCost      = (RadNumericTextBox)dataItem.FindControl("tbNetCost");

                    RadNumericTextBox tbTax           = (RadNumericTextBox)dataItem.FindControl("tbTax");
                    RadNumericTextBox tbTotal         = (RadNumericTextBox)dataItem.FindControl("tbTotal");
                    RadNumericTextBox tbEstimatedCost = (RadNumericTextBox)dataItem.FindControl("tbEstimatedCost");

                    tbNetCost.Culture = tbTax.Culture = tbTotal.Culture = tbEstimatedCost.Culture = new System.Globalization.CultureInfo(CultureName);

                    txtDescription.Text = itemBriefTask.Description;
                    txtVendor.Text      = itemBriefTask.Vendor;
                    if (chkStatus != null)
                    {
                        chkStatus.Enabled = false;

                        if (itemBriefTask.ItemBriefTaskStatusCodeId == codeInprogress.CodeId)
                        {
                            tbNetCost.Enabled = false;
                            tbTax.Enabled     = false;
                            tbTotal.Enabled   = false;
                        }
                    }
                }
                else if (e.Item is GridDataItem)
                {
                    HtmlImage imgNoEstimatedCost = (HtmlImage)dataItem.FindControl("imgNoEstimatedCost");
                    imgNoEstimatedCost.Visible = (itemBriefTask.EstimatedCost == null && itemBriefTask.ItemBriefTaskStatusCodeId == Utils.GetCodeByValue("ItemBriefTaskStatusCode", "INPROGRESS").CodeId);

                    //Description
                    dataItem["Description"].Text = Support.TruncateString(itemBriefTask.Description, 20);
                    if (itemBriefTask.Description != null && itemBriefTask.Description.Length > 20)
                    {
                        dataItem["Description"].ToolTip = itemBriefTask.Description;
                    }

                    //Vendor
                    dataItem["Vendor"].Text = Support.TruncateString(itemBriefTask.Vendor, 10);

                    if (itemBriefTask.Vendor != null && itemBriefTask.Vendor.Length > 10)
                    {
                        dataItem["Vendor"].ToolTip = itemBriefTask.Vendor;
                    }
                }

                ImageButton DeleteBtn = (ImageButton)dataItem["DeleteColumn"].Controls[0];
                if (DisplayMode == ViewMode.TaskListView)
                {
                    DeleteBtn.ToolTip = "Remove task from task list";
                }
                else
                {
                    DeleteBtn.ToolTip = "Remove task";
                }
            }
        }
        protected void RadGridUsuarios_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "InitInsert":    //Insercion
                    e.Canceled                      = true;
                    panelGrilla.Visible             = false;
                    panelComboUsuario.Visible       = true;
                    panelAgregarUsuario.Visible     = false;
                    cboTipoIdentificacion.Enabled   = true;
                    txtNumeroIdentificacion.Enabled = true;
                    break;

                case "Buscar":
                    pacienteNegocio = new PacienteNegocio();
                    sm_Persona   persona = new sm_Persona();
                    Hashtable    valores = new Hashtable();
                    GridDataItem item    = (GridDataItem)e.Item;
                    item.ExtractValues(valores);
                    cargarEmpresas();
                    cargarCiudades();
                    cargarRoles();
                    cargarTiposIdentificacion();
                    /*Carga la informacion de la persona*/
                    cboTipoIdentificacion.SelectedValue = item.GetDataKeyValue("idTipoIdentificacion").ToString();
                    txtNumeroIdentificacion.Text        = valores["numeroIdentificacion"].ToString();
                    persona = pacienteNegocio.ConsultarPersona(Convert.ToInt16(item.GetDataKeyValue("idTipoIdentificacion")), valores["numeroIdentificacion"].ToString());
                    txtPrimerNombre.Text = item.GetDataKeyValue("primerNombre").ToString();
                    if (item.GetDataKeyValue("segundoNombre") != null)
                    {
                        txtSegundoNombre.Text = item.GetDataKeyValue("segundoNombre").ToString();
                    }
                    else
                    {
                        txtSegundoNombre.Text = string.Empty;
                    }
                    txtPrimerApellido.Text = item.GetDataKeyValue("primerApellido").ToString();
                    if (item.GetDataKeyValue("segundoApellido") != null)
                    {
                        txtSegundoApellido.Text = item.GetDataKeyValue("segundoApellido").ToString();
                    }
                    else
                    {
                        txtSegundoApellido.Text = string.Empty;
                    }
                    rdpFechaNacimiento.SelectedDate = persona.fechaNacimiento;
                    cboCiudad.SelectedValue         = item.GetDataKeyValue("idCiudad").ToString();
                    txtCelular.Text      = valores["celular"].ToString();
                    txtTelefonoFijo.Text = valores["telefonoFijo"].ToString();
                    txtCorreo.Text       = valores["correo"].ToString();
                    /*Carga la informacion del usuario*/
                    adminNegocio = new AdministracionNegocio();
                    int     tipoID  = Convert.ToInt32(item.GetDataKeyValue("idTipoIdentificacion").ToString());
                    Usuario usuario = adminNegocio.ListarUsuarios(tipoID, valores["numeroIdentificacion"].ToString(), 1).FirstOrDefault();
                    if (usuario == null)
                    {
                        chkMedicoTratante.Checked = true;
                    }
                    else
                    {
                        txtUsuario.Text          = usuario.usuario;
                        txtContrasena.Text       = usuario.contrasena;
                        cboEmpresa.SelectedValue = usuario.idEmpresa.ToString();
                        foreach (sm_Rol rol in usuario.Roles)
                        {
                            foreach (RadComboBoxItem c in cboRol.Items)
                            {
                                if (c.Value.ToString().Equals(rol.idRol.ToString()))
                                {
                                    c.Checked = true;
                                }
                            }
                        }
                        cboEstado.SelectedValue = usuario.estado.ToString();
                    }
                    /*Hidden Fields*/
                    if (usuario != null)
                    {
                        hdfIdUsuario.Value = item.GetDataKeyValue("idUsuario").ToString();
                    }
                    else
                    {
                        hdfIdUsuario.Value = "0";
                    }
                    hdfCreatedBy.Value              = item.GetDataKeyValue("createdBy").ToString();;
                    hdfCreatedDate.Value            = item.GetDataKeyValue("createdDate").ToString();;
                    panelGrilla.Visible             = false;
                    panelComboUsuario.Visible       = false;
                    panelAgregarUsuario.Visible     = true;
                    btnAgregarUsuario.Visible       = false;
                    btnActualizar.Visible           = true;
                    cboTipoIdentificacion.Enabled   = false;
                    txtNumeroIdentificacion.Enabled = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                MostrarMensaje("Error: " + ex.Message, true);
            }
        }
 private void OpenAttachment(GridDataItem gdItem)
 {
     try
     {
         string filepath = gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["FilePath"].ToString();
         am.Utility.FileDownload(Page, PODownloadURL, filepath);
     }
     catch (Exception ex)
     {
         am.Utility.ShowHTMLMessage(Page, "000", ex.Message);
     }
 }
        protected void rgChildFamily_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Guid SchoolId            = new Guid();
            Guid CurrentSchoolYearId = new Guid();

            if (Session["SchoolId"] != null)
            {
                SchoolId = new Guid(Session["SchoolId"].ToString());
            }

            if (Session["CurrentSchoolYearId"] != null)
            {
                CurrentSchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString());
            }

            //if (!Common.IsCurrentYear(CurrentSchoolYearId, SchoolId))
            //{
            //    //if (e.CommandName == "InitInsert")
            //    //{
            //    //    e.Canceled = true;
            //    //}
            //    //else if (e.CommandName == "Edit")
            //    //{
            //    //    e.Canceled = true;
            //    //}
            //}
            //else
            //{
            string       FamilyName = "";
            GridDataItem itm        = e.Item as GridDataItem;

            if (itm != null)
            {
                FamilyName = itm["FamilyTitle"].Text;
            }
            Session["ChildFamilyUrl"] = "~/UI/ChildFamily.aspx";
            if (e.CommandName == "Edit")
            {
                Guid ChildFamilyId = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                if (!string.IsNullOrEmpty(FamilyName))
                {
                    Session["ChildFamilyName"] = ": " + FamilyName;
                }
                if (ChildFamilyId != null)
                {
                    ViewState["ChildFamilyId"] = ChildFamilyId;
                }
                //LoadDataById(ChildFamilyId);
                e.Canceled = true;
                Response.Redirect("familyinfo.aspx?ChildFamilyId=" + ChildFamilyId);
            }
            if (e.CommandName == "InitInsert")
            {
                if (!string.IsNullOrEmpty(FamilyName))
                {
                    Session["ChildFamilyName"] = ": " + FamilyName;
                }
                Response.Redirect("familyinfo.aspx?ChildFamilyId=");
            }
            // }
        }
        /// <summary>
        /// Build an item key that will uniquely identify a grid item
        /// among all the items in the RadGrid hierarchy. Use a combination 
        /// of the OwnerTableView.UniqueID and the set of all data values.
        /// </summary>
        protected string BuildItemKey(GridDataItem item)
        {
            string[] keyNames = item.OwnerTableView.DataKeyNames;
            if (keyNames.Length == 0) return item.ItemIndexHierarchical;

            string returnKey = item.OwnerTableView.UniqueID + "::";

            foreach (string keyName in keyNames)
            {
                returnKey += item.GetDataKeyValue(keyName).ToString();

                if (keyName != keyNames[keyNames.Length - 1])
                {
                    returnKey += "::";
                }
            }

            return returnKey;
        }
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item       = (GridDataItem)e.Item;
            string       mat_req_id = item.GetDataKeyValue("MAT_REQ_ID").ToString();
            string       mat_req_no = WebTools.GetExpr("MAT_REQ_NO", "MATERIAL_REQUEST", " MAT_REQ_ID = " + mat_req_id);
            string       filename   = mat_req_no + ".pdf";

            string pdf_url     = WebTools.GetExpr("PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'MAT_REQUEST'");
            string pdf_asp_url = WebTools.GetExpr("ASP_PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'MAT_REQUEST'");

            string full_pdf_path = pdf_url + filename;
            string full_asp_path = pdf_asp_url + filename;
            Label  pdf_label     = (Label)item.FindControl("pdf");
            string status_flg    = WebTools.GetExpr("STATUS_FLG", "MATERIAL_REQUEST", " MAT_REQ_ID = " + mat_req_id);
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;

                if (status_flg == "Y" && !WebTools.UserInRole("ADMIN"))
                {
                    ImageButton btnEdit = (ImageButton)dataItem["EditCommandColumn"].Controls[0];
                    btnEdit.Visible = false;

                    ImageButton btnDelete = (ImageButton)dataItem["DeleteColumn"].Controls[0];
                    btnDelete.Visible = false;
                }
            }


            if (File.Exists(full_pdf_path))
            {
                string url     = "<a title='REQUEST PDF' href='" + full_asp_path + "' target='_blank'><img src='../Images/New-Icons/pdf.png'/></a>";
                Label  pdficon = (Label)item.FindControl("pdf");
                if (pdficon != null)
                {
                    pdficon.Text = url;
                }
            }
        }
        if (e.Item.IsInEditMode && e.Item is GridEditableItem)
        {
            string query = "SELECT * FROM USER_MODULE_COLUMNS WHERE NOT  EXISTS (SELECT 1 FROM USER_MODULE_ROLES WHERE  " +
                           " SEQ =USER_MODULE_COLUMNS.SEQ   AND  USER_ID IN (SELECT USER_ID FROM USERS WHERE USER_NAME ='" + Session["USER_NAME"] + "' ))  AND HIDE_COL_NAME IS NOT NULL  AND  MODULE_ID =15 ";
            DataTable        dt       = WebTools.getDataTable(query);
            GridEditableItem dataItem = e.Item as GridEditableItem;

            foreach (DataRow row in dt.Rows)
            {
                string hide_col = row["HIDE_COL_NAME"].ToString();
                dataItem[hide_col].Enabled             = false;
                dataItem[hide_col].Controls[0].Visible = false;
            }
            string lbl_query = "SELECT * FROM USER_MODULE_COLUMNS WHERE NOT  EXISTS (SELECT 1 FROM USER_MODULE_ROLES WHERE  " +
                               " SEQ =USER_MODULE_COLUMNS.SEQ   AND  USER_ID IN (SELECT USER_ID FROM USERS WHERE USER_NAME ='" + Session["USER_NAME"] + "' ))  AND LBL_COL_NAME IS NOT NULL  AND  MODULE_ID =15";
            DataTable lbl_dt    = WebTools.getDataTable(lbl_query);
            Label[]   descLabel = new Label[30];
            int       i         = 0;
            foreach (DataRow row in lbl_dt.Rows)
            {
                string lbl_col = row["LBL_COL_NAME"].ToString();

                string str = (dataItem[lbl_col].Controls[0] as TextBox).Text;
                descLabel[i]      = new Label();
                descLabel[i].Text = str;
                dataItem[lbl_col].Controls.Add(descLabel[i]);
                i++;
            }
        }
    }
 private void Delete(GridDataItem gdItem)
 {
     int ID;
     try
     {
         ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["GroupID"]);
         DeleteRecord(ID);
     }
     catch (Exception ex)
     {
         am.Utility.ShowHTMLMessage(Page, "000", ex.Message);
     }
 }
    // form input control settings for insert/udpate
    protected void gvExpense_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            if (e.Item.OwnerTableView.DataMember == "ExpenseMaster")
            {
                ValidateExpenseDetail(e);
                if (e.Item.OwnerTableView.IsItemInserted)
                {
                    #region  item is about to be inserted

                    GridEditableItem insertedItem = (GridEditableItem)e.Item;



                    #endregion
                }
                else
                {
                    #region item is about to be edited
                    GridEditableItem editedItem = (GridEditableItem)e.Item;

                    RadComboBox ddlEmployee = (RadComboBox)editedItem.FindControl("ddlEmployee");

                    if (ddlEmployee != null)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("@exptidd", editedItem.GetDataKeyValue("exptidd").ToString());

                        DataTable dtEmp = clsDAL.GetDataSet_Payroll("sp_Payroll_Get_ExpTypeEmpAssignment_detail", ht).Tables[0];

                        RadGrid grid = ddlEmployee.Items[0].FindControl("rGrdEmployee4DDL") as RadGrid;
                        if (grid != null)
                        {
                            grid.Rebind();
                            ddlEmployee.Text = string.Empty;
                            foreach (GridItem item in grid.MasterTableView.Items)
                            {
                                if (item is GridDataItem)
                                {
                                    GridDataItem dataItem = (GridDataItem)item;

                                    foreach (DataRow row in dtEmp.Rows)
                                    {
                                        if (row["empidd"].ToString().Equals(dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["recidd"].ToString()))
                                        {
                                            if (!string.IsNullOrEmpty(ddlEmployee.Text))
                                            {
                                                ddlEmployee.Text = ddlEmployee.Text + ",";
                                            }
                                            ddlEmployee.Text  = ddlEmployee.Text + row["empcod"].ToString();
                                            dataItem.Selected = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    #endregion
                }
            }
            else if (e.Item.OwnerTableView.DataMember == "ExpSubTypeDetail")
            {
                ValidateExpenseDetail(e);
                if (e.Item.OwnerTableView.IsItemInserted)
                {
                    #region  item is about to be inserted

                    GridEditableItem insertedItem = (GridEditableItem)e.Item;


                    #endregion
                }
                else
                {
                    #region item is about to be edited

                    GridEditableItem editedItem = (GridEditableItem)e.Item;

                    RadComboBox ddlEmployee = (RadComboBox)editedItem.FindControl("ddlEmployee");

                    if (ddlEmployee != null)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("@exptidd", editedItem.GetDataKeyValue("exptidd").ToString());
                        ht.Add("@expsubtidd", editedItem.GetDataKeyValue("expsubtidd").ToString());
                        DataTable dtEmp = clsDAL.GetDataSet_Payroll("sp_Payroll_Get_ExpenseEmployeeAssignment_detail", ht).Tables[0];

                        RadGrid grid = ddlEmployee.Items[0].FindControl("rGrdEmployee4DDL") as RadGrid;
                        if (grid != null)
                        {
                            grid.Rebind();
                            ddlEmployee.Text = string.Empty;
                            foreach (GridItem item in grid.MasterTableView.Items)
                            {
                                if (item is GridDataItem)
                                {
                                    GridDataItem dataItem = (GridDataItem)item;

                                    foreach (DataRow row in dtEmp.Rows)
                                    {
                                        if (row["empidd"].ToString().Equals(dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["recidd"].ToString()))
                                        {
                                            if (!string.IsNullOrEmpty(ddlEmployee.Text))
                                            {
                                                ddlEmployee.Text = ddlEmployee.Text + ",";
                                            }
                                            ddlEmployee.Text  = ddlEmployee.Text + row["empcod"].ToString();
                                            dataItem.Selected = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }


                    #endregion
                }
            }
        }
        if (e.Item is GridCommandItem)
        {
            GridCommandItem commandItem     = (GridCommandItem)e.Item;
            RadComboBox     ddlPrintOptions = (RadComboBox)commandItem.FindControl("ddlPrintOptions");
            if (ddlPrintOptions != null)
            {
                Hashtable ht_Reports = new Hashtable();
                ht_Reports.Add("@userid", Session["_UserID"].ToString());
                ht_Reports.Add("@formtypeid", formType);
                DataTable dt_Reports = clsDAL.GetDataSet_admin("sp_Payroll_Get_Reports", ht_Reports).Tables[0];
                if (ddlPrintOptions != null)
                {
                    ddlPrintOptions.DataSource     = dt_Reports;
                    ddlPrintOptions.DataTextField  = "reportname";
                    ddlPrintOptions.DataValueField = "idd";
                    ddlPrintOptions.DataBind();
                    ddlPrintOptions.SelectedIndex = 0;
                }
            }
        }
    }
 private void eliminarArchivo(GridDataItem g)
 {
     Consulta c = new Consulta();
     try
     {
         ArchivoDependiente a = c.consultarArchivosDependientesOBJ(g.GetDataKeyValue("cod_archivo").ToString(), g.GetDataKeyValue("cod_archivo_dep").ToString());
         if (a != null)
         {
             RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta();
             InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name));
             i.IUDarchivoDependiente(a, 4);
             cargarTabla2();
             this.RadWindowManager1.RadAlert("Archivo eliminado correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
                 null, Utilities.pathImageMessage(TypeMessage.information_message));
         }
     }
     catch(Exception ex)
     {
         Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex);
         this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.information_message),
             null, Utilities.pathImageMessage(TypeMessage.error_message));
     }
 }
    protected void rglocationjobs_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditFormInsertItem)
        {
            GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;

            RadComboBox ddlcountry = (RadComboBox)item.FindControl("rcbCountry");
            DataSet     dscountry  = populatecountry();
            if (dscountry.Tables.Count > 0 && dscountry.Tables[0].Rows.Count > 0)
            {
                ddlcountry.DataSource     = dscountry;
                ddlcountry.DataTextField  = "CountryName";
                ddlcountry.DataValueField = "CountryId";
                ddlcountry.DataBind();
            }
            else
            {
                ddlcountry.DataSource = null;
                ddlcountry.DataBind();
            }

            RadComboBoxItem ascountryListItem = new RadComboBoxItem("--Select--", "--Select--");
            ddlcountry.Items.Insert(0, ascountryListItem);


            RadComboBox     rdState         = (RadComboBox)item.FindControl("rcbState");
            RadComboBoxItem asstateListItem = new RadComboBoxItem("--Select--", "--Select--");
            rdState.Items.Insert(0, asstateListItem);
            RadComboBox     rdCity         = (RadComboBox)item.FindControl("rcbCity");
            RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
            rdCity.Items.Insert(0, ascityListItem);
        }

        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted))
        {
            GridEditableItem edititem = (GridEditableItem)e.Item;
            if (Session["SignInOrganizationId"] != null)
            {
                _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString());
            }

            RadComboBox ddlcountry = (RadComboBox)edititem.FindControl("rcbCountry");
            DataSet     dscountry  = populatecountry();
            if (dscountry.Tables.Count > 0 && dscountry.Tables[0].Rows.Count > 0)
            {
                ddlcountry.DataSource     = dscountry;
                ddlcountry.DataTextField  = "CountryName";
                ddlcountry.DataValueField = "CountryId";
                ddlcountry.DataBind();
            }
            else
            {
                ddlcountry.DataSource = null;
                ddlcountry.DataBind();
            }

            RadComboBoxItem ascountryListItem = new RadComboBoxItem("--Select--", "--Select--");
            ddlcountry.Items.Insert(0, ascountryListItem);
            ddlcountry.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[2].ToString();
            ddlcountry.Enabled       = false;
            RadComboBox rdState = (RadComboBox)edititem.FindControl("rcbState");
            RadComboBox rdCity  = (RadComboBox)edititem.FindControl("rcbCity");
            _countryid = Convert.ToInt32(ddlcountry.SelectedValue);
            rdState.Items.Clear();
            string[] strArrCountryids = ("2,12,15,18,26,29,35,51,54,66,75,87,93,96,98,117,121,123,133,135,136,140,148,156,158,162,163,176,181,187,188,199,205,212,218,219").Split(',');

            if (strArrCountryids.Contains(_countryid.ToString()))
            {
                DataSet dscity = populatestate(_countryid);
                rdCity.Items.Clear();
                if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0)
                {
                    rdCity.DataSource     = dscity;
                    rdCity.DataTextField  = "CityName";
                    rdCity.DataValueField = "CityId";
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                }
                else
                {
                    rdCity.DataSource = null;
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                    edititem["CityName"].Parent.Visible = false;
                }
                rdCity.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[7].ToString();
                edititem["StateName"].Parent.Visible = false;
            }
            else
            {
                DataSet dsstate = populatestate(_countryid);
                if (dsstate.Tables.Count > 0 && dsstate.Tables[0].Rows.Count > 0)
                {
                    rdState.DataSource     = dsstate;
                    rdState.DataTextField  = "StateName";
                    rdState.DataValueField = "StateId";
                    rdState.DataBind();
                    RadComboBoxItem asstateListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdState.Items.Insert(0, asstateListItem);
                }
                else
                {
                    rdState.DataSource = null;
                    rdState.DataBind();
                    RadComboBoxItem asstateListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdState.Items.Insert(0, asstateListItem);
                }
                rdState.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[3].ToString();

                if (Session["SignInOrganizationId"] != null)
                {
                    _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString());
                }
                _countryid = Convert.ToInt32(ddlcountry.SelectedValue);
                _stateid   = Convert.ToInt32(rdState.SelectedValue);
                rdCity.Items.Clear();
                DataSet dscity = populatecity(_countryid, _stateid);
                if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0)
                {
                    rdCity.DataSource     = dscity;
                    rdCity.DataTextField  = "CityName";
                    rdCity.DataValueField = "CityId";
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                }
                else
                {
                    rdCity.DataSource = null;
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                    edititem["CityName"].Parent.Visible = false;
                }
                rdCity.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[7].ToString();
            }



            CheckBox chkVisibilty = (CheckBox)edititem.FindControl("chkVisibilty");
            if (((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[8].ToString() == "True")
            {
                chkVisibilty.Checked = true;
            }
            else
            {
                chkVisibilty.Checked = false;
            }
        }

        if (e.Item is GridDataItem)
        {
            GridDataItem dataitem      = (GridDataItem)e.Item;
            Label        lbvisibility  = (Label)dataitem.FindControl("lbvisibility");
            Image        imgVisibility = (Image)dataitem.FindControl("imgVisibility");
            if (lbvisibility.Text == "True")
            {
                imgVisibility.ImageUrl = "../ImagesNew/Jobs/green-tick-mark.gif";
            }
            else
            {
                imgVisibility.ImageUrl = "../ImagesNew/Jobs/red_x_mark.png";
            }

            _lid      = Convert.ToInt32(((System.Data.DataRowView)(dataitem.DataItem)).Row.ItemArray[0].ToString());
            _clientid = Convert.ToInt32(((System.Data.DataRowView)(dataitem.DataItem)).Row.ItemArray[9].ToString());



            DataSet ds = objJobsBAL.FindJobsAssociateWithLocation(_clientid, _lid);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ImageButton imgdelete = (ImageButton)dataitem.FindControl("imgdelete");
                imgdelete.OnClientClick = "return confirm('Jobs Associated with this Location.Do you want to delete this Location and Jobs?')";
            }
            else
            {
                ImageButton imgdelete = (ImageButton)dataitem.FindControl("imgdelete");
                imgdelete.OnClientClick = "return confirm('Do you want to delete this Location?')";
            }
        }
    }
 private void guardarDatos(GridDataItem g)
 {
     DataRow[] d = this.tablaDatos2.Select("id_var_dependiente = " + g.OwnerTableView.DataKeyValues[g.ItemIndex]["id_var_dependiente"]);
     if (d.Length == 0)
     {
         Consulta c = new Consulta();
         RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta();
         InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name));
         DetalleGrupoDependiente g1 = new DetalleGrupoDependiente(0);
         try
         {
             g1.varDependiente = c.consultarVariablesDependientesOBJ((int)g.OwnerTableView.DataKeyValues[g.ItemIndex]["id_var_dependiente"]);
             g1.estado = c.consultarEstadoParametrizacionOBJ(Convert.ToInt32(g.GetDataKeyValue("estado_parametrizado")));
             int idEncabezado = Request.QueryString["idEncabezado"] != null ? Convert.ToInt32(Request.QueryString["idEncabezado"]) : 0;
             g1.encabezadoGrupo = c.consultarEncabezadoGruposDependenciasOBJ(idEncabezado);
             g1.descripcion = "Cruce Automatico";
             i.IUDdetGrupoVariableDependiente(g1, 2);
             this.RadWindowManager1.RadAlert("Datos agregados correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
                 null, Utilities.pathImageMessage(TypeMessage.information_message));
             cargarGrilla2();
         }
         catch(Exception ex)
         {
             Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex);
             this.RadWindowManager1.RadAlert(Utilities.errorMessage(),400,200,Utilities.windowTitle(TypeMessage.error_message),
                 null, Utilities.pathImageMessage(TypeMessage.error_message));
         }
     }
     else
     {
         this.RadWindowManager1.RadAlert("La validación que intenta agrupar ya se encuentra en el grupo.", 400, 200,
             Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message));
     }
 }
Example #50
0
        public static bool IsGridDataItemChanged(GridDataItem i,RadGrid grid)
        {
            bool returnValue = false;

            foreach (GridColumn c in grid.Columns)
            {
                string strNewValue = "";
                RadTextBox txtNewValue = i[c.UniqueName].Controls[1] as RadTextBox;
                if (txtNewValue == null)
                {
                    CodeList clNewValue = i[c.UniqueName].Controls[1] as CodeList;
                    if (clNewValue == null) continue;
                    strNewValue = clNewValue.CODE;
                }
                else
                {
                    strNewValue = txtNewValue.Text;
                }

                object objOldValue = i.SavedOldValues[c.UniqueName];
                if (objOldValue == null)
                {
                    //và ko có sửa gì
                    if (string.IsNullOrEmpty(strNewValue))
                    {
                        continue;//thì tiếp tục
                    }
                    else//có sự thay đổi
                    {
                        returnValue = true;
                        break;
                    }
                }
                if (objOldValue.Equals(strNewValue)) continue;
                returnValue = true;
                break;
            }

            return returnValue;
        }
        private void OpenAttachment(GridDataItem gdItem)
        {
            try
            {

                //string filepath = gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["FilePath"].ToString();
                //string folderPath = "~/bin/SelectionAttachment";
                //String targetFolder = Server.MapPath(folderPath);
                //string path = Path.Combine(targetFolder, filepath);
                //System.Diagnostics.Process.Start(path);
                string filepath = gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["FilePath"].ToString();
                am.Utility.FileDownload(Page, VSDownloadURL, filepath);
            }
            catch (Exception ex)
            {
                am.Utility.ShowHTMLMessage(Page, "000", ex.Message);
            }
        }
Example #52
0
 public static void CopyData(GridDataItem item, object outObj)
 {
     foreach (PropertyInfo i in outObj.GetType().GetProperties())
     {
         if (i.PropertyType.FullName.Equals(typeof(string).FullName) == true)
         {
             RadTextBox txt = item[i.Name].Controls[1] as RadTextBox;
             if (txt == null)
             {
                 //thử với label
                 Label lbl = item[i.Name].Controls[1] as Label;
                 if (lbl == null)
                 {
                     //thử với code list
                     CodeList cl = item[i.Name].Controls[1] as CodeList;
                     if (cl == null) continue;
                     i.SetValue(outObj, cl.CODE, null);
                     continue;
                 }
                 else
                 {
                     i.SetValue(outObj, lbl.Text, null);
                     continue;
                 }
             }
             else
             {
                 i.SetValue(outObj, txt.Text, null);
                 continue;
             }
         }
         if (i.PropertyType.FullName.Equals(typeof(decimal).FullName) == true)
         {
             RadNumericTextBox txt = item[i.Name].Controls[1] as RadNumericTextBox;
             if (txt == null) continue;
             decimal dm = 0;
             if (decimal.TryParse(txt.Text, out dm) == true)
                 i.SetValue(outObj, dm, null);
             continue;
         }
     }
 }
        private void EditRecord(GridDataItem gdItem)
        {
            int ID;
            ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["ProcessID"]);
            string idStr = ID.ToString();

            DataTable dt = null;
            DataRow dr = null;

            dt = am.DataAccess.RecordSet("select * from Process WHERE ProcessID=@ProcessID", new string[] { idStr });
            if (dt != null && dt.Rows.Count > 0)
            {
                dr = dt.Rows[0];
            }

            if (dr != null)
            {
                //Store Id
                hdfId.Value = idStr;

                tbxName.Text = dr["ProcessName"].ToString();
                chkActive.Checked = Convert.ToBoolean(dr["Active"]);
                tbxDescription.Text = dr["Description"].ToString();
                tbxLeadTime.Value = int.Parse(dr["LeadTime"].ToString());
            }
        }
Example #54
0
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridCommandItem)
            {
                GridCommandItem item = (GridCommandItem)e.Item;
                ImageButton     img  = (ImageButton)item.FindControl("New");
                img.Visible = permiso.Crear;
                if (Request.QueryString["RevisionId"] != null)
                {
                    img.OnClientClick = String.Format("newIncidenciaRevision({0});", dispositivo.DispositivoId);
                    // img.Visible = false; // no tengo claro si merece o no tratamiento.
                }
                else if (dispositivo != null)
                {
                    img.OnClientClick = String.Format("newIncidenciaDispositivo({0});", dispositivo.DispositivoId);
                    // img.Visible = false; // no tengo claro si merece o no tratamiento.
                    img         = (ImageButton)item.FindControl("Exit");
                    img.Visible = false;
                }
                else
                {
                    img.OnClientClick = String.Format("newIncidencia();");
                }
            }
            if (e.Item is GridDataItem)
            {
                ImageButton  imgb     = null;
                string       jCommand = "";
                GridDataItem item     = (GridDataItem)e.Item;
                string       strKey   = item.GetDataKeyValue("IncidenciaId").ToString();


                if (CntLainsaSci.FechaNula(DateTime.Parse(item["Fecha"].Text)))
                {
                    item["Fecha"].Text = "";
                }

                // when it returns from form with new record
                if (Session["NewRecordId"] != null)
                {
                    if (strKey == Session["NewRecordId"] as String)
                    {
                        item.Selected          = true;
                        Session["NewRecordId"] = null;
                    }
                }

                // in order to assign the appropiate javascript function to select button
                imgb = (ImageButton)item.FindControl("Select");
                //jCommand = String.Format("returnValues3('{0}','{1}','{2}');", strKey, item["Fecha"].Text, "Incidencia");
                //imgb.OnClientClick = jCommand;
                //if (mode == "S")
                //    imgb.Visible = true;
                //else
                imgb.Visible = false;

                // assign the appropiate javascript function to edit button
                imgb     = (ImageButton)item.FindControl("Edit");
                jCommand = String.Format("editIncidencia({0});", strKey);
                if (Request.QueryString["RevisionId"] != null)
                {
                    jCommand = String.Format("editIncidenciaFromRevision({0},{1});", strKey, dispositivo.DispositivoId);
                }
                else if (dispositivo != null)
                {
                    jCommand = String.Format("editIncidenciaFromDispositivo({0},{1});", strKey, dispositivo.DispositivoId);
                }
                imgb.OnClientClick = jCommand;
                imgb.Visible       = permiso.Ver;

                // assign to delete button (not needed by now)
                imgb               = (ImageButton)item.FindControl("Delete");
                jCommand           = String.Format("return radconfirm('{0}',event,300,100,'','{1}');", Resources.ResourceLainsaSci.DeleteRecordQuestion + " " + item["IncidenciaId"].Text, Resources.ResourceLainsaSci.DeleteRecord);
                imgb.OnClientClick = jCommand;
                imgb.Visible       = permiso.Crear;
            }
        }
        private void Edit(GridDataItem gdItem)
        {
            int ID;
            try
            {
                ID = Convert.ToInt32(gdItem.OwnerTableView.DataKeyValues[gdItem.ItemIndex]["UserID"]);
                string idStr = ID.ToString();
                ShowRecord(idStr);
            }
            catch (Exception ex)
            {

            }
        }
Example #56
0
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            GridCommandItem item     = (GridCommandItem)e.Item;
            ImageButton     imgb     = (ImageButton)item.FindControl("New");
            string          jCommand = "";
            if (empresa != null)
            {
                jCommand = String.Format("newTelefono('Empresa', {0}, '{1}')", empresa.EmpresaId, caller);
            }
            if (instalacion != null)
            {
                jCommand = String.Format("newTelefono('Instalacion', {0}, '{1}')", instalacion.InstalacionId, caller);
            }
            imgb.OnClientClick = jCommand;
            //imgb.Visible = permiso.Crear;
        }
        if (e.Item is GridDataItem)
        {
            ImageButton  imgb     = null;
            string       jCommand = "";
            GridDataItem item     = (GridDataItem)e.Item;
            string       strKey   = item.GetDataKeyValue("TelefonoId").ToString();

            // when it returns from form with new record
            if (Session["NewRecordId"] != null)
            {
                if (strKey == Session["NewRecordId"] as String)
                {
                    item.Selected          = true;
                    Session["NewRecordId"] = null;
                }
            }

            // in order to assign the appropiate javascript function to select button
            imgb               = (ImageButton)item.FindControl("Select");
            jCommand           = String.Format("returnValues2('{0}','{1}');", strKey, item["Numero"].Text);
            imgb.OnClientClick = jCommand;
            if (mode == "S")
            {
                imgb.Visible = true;
            }
            else
            {
                imgb.Visible = false;
            }

            // assign the appropiate javascript function to edit button
            imgb               = (ImageButton)item.FindControl("Edit");
            jCommand           = String.Format("editTelefono('{0}','{1}');", strKey, caller);
            imgb.OnClientClick = jCommand;
            //imgb.Visible = permiso.Ver;

            // assign to delete button (not needed by now)
            imgb               = (ImageButton)item.FindControl("Delete");
            jCommand           = String.Format("return radconfirm('{0}',event,300,100,'','{1}');", Resources.ResourceLainsaSci.DeleteRecordQuestion + " " + item["Numero"].Text, Resources.ResourceLainsaSci.DeleteRecord);
            imgb.OnClientClick = jCommand;
            //imgb.Visible = permiso.Crear;
        }
    }
Example #57
0
 protected string GenerateUniqueIdentifier(GridDataItem item)
 {
     StringBuilder uniqueIdentifier = new StringBuilder();
     GridDataItem currentItem = item;
     //Traversing the parent items up in the hierarchy to generate a unique key
     while (true)
     {
         uniqueIdentifier.Append(currentItem.GetDataKeyValue(currentItem.OwnerTableView.DataKeyNames[0]).ToString());
         currentItem = currentItem.OwnerTableView.ParentItem;
         if (currentItem == null)
         {
             break;
         }
     }
     return uniqueIdentifier.ToString();
 }
        protected void gvSchemeDetails_ItemCommand(object source, GridCommandEventArgs e)
        {
            int      strSchemePlanCode = 0;
            int      Isonline          = 0;
            string   strExternalCode   = string.Empty;
            string   strExternalType   = string.Empty;
            DateTime createdDate       = new DateTime();
            DateTime editedDate        = new DateTime();
            DateTime deletedDate       = new DateTime();

            if (e.CommandName == RadGrid.UpdateCommandName)
            {
                strExternalCodeToBeEdited = Session["extCodeTobeEdited"].ToString();
                CustomerBo       customerBo        = new CustomerBo();
                bool             isUpdated         = false;
                GridEditableItem gridEditableItem  = (GridEditableItem)e.Item;
                TextBox          txtExtCode        = (TextBox)e.Item.FindControl("txtExternalCodeForEditForm");
                DropDownList     txtExtType        = (DropDownList)e.Item.FindControl("ddlExternalType");
                TextBox          txtSchemePlancode = (TextBox)e.Item.FindControl("txtSchemePlanCodeForEditForm");
                DropDownList     ddlIsonline       = (DropDownList)e.Item.FindControl("ddlONline");
                strSchemePlanCode = int.Parse(txtSchemePlancode.Text);
                strExternalCode   = txtExtCode.Text;
                strExternalType   = txtExtType.Text;
                Isonline          = Convert.ToInt32(ddlIsonline.Text.ToString());
                editedDate        = DateTime.Now;
                int count = customerBo.ToCheckSchemeisonline(strSchemePlanCode, Isonline, strExternalCode);
                if (count > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('this scheme is allready onlline!!');", true);
                    return;
                }
                //isUpdated = false;
                isUpdated = customerBo.EditProductAMCSchemeMapping(strSchemePlanCode, strExternalCodeToBeEdited, strExternalCode, Isonline, strExternalType, createdDate, editedDate, deletedDate, userVo.UserId);
            }
            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                bool isDeleted = false;
                customerBo = new CustomerBo();
                GridDataItem dataItem = (GridDataItem)e.Item;
                TableCell    strSchemePlanCodeForDelete = dataItem["PASP_SchemePlanCode"];
                TableCell    strSchemePlanNameForDelete = dataItem["PASP_SchemePlanName"];
                TableCell    StrExternalCodeForDelete   = dataItem["PASC_AMC_ExternalCode"];
                TableCell    strExternalTypeForDelete   = dataItem["PASC_AMC_ExternalType"];
                strSchemePlanCode = int.Parse(strSchemePlanCodeForDelete.Text);
                strExternalCode   = StrExternalCodeForDelete.Text;
                strExternalType   = strExternalTypeForDelete.Text;
                deletedDate       = DateTime.Now;
                isDeleted         = customerBo.DeleteMappedSchemeDetails(strSchemePlanCode, strExternalCode, strExternalType, createdDate, editedDate, deletedDate);
            }
            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                CustomerBo       customerBo        = new CustomerBo();
                bool             isInserted        = false;
                GridEditableItem gridEditableItem  = (GridEditableItem)e.Item;
                TextBox          txtExtCode        = (TextBox)e.Item.FindControl("txtExternalCodeForEditForm");
                DropDownList     txtExtType        = (DropDownList)e.Item.FindControl("ddlExternalType");
                TextBox          txtSchemePlancode = (TextBox)e.Item.FindControl("txtSchemePlanCodeForEditForm");
                TextBox          txtSchemePlanName = (TextBox)e.Item.FindControl("txtSchemePlanNameForEditForm");
                strSchemePlanCode = int.Parse(txtSchemePlancode.Text);
                strExternalCode   = txtExtCode.Text;
                strExternalType   = txtExtType.Text;
                createdDate       = DateTime.Now;
                isInserted        = customerBo.InsertProductAMCSchemeMappingDetalis(strSchemePlanCode, strExternalCode, strExternalType, createdDate, editedDate, deletedDate);
            }
            BindSchemePlanDetails();
        }
Example #59
0
 private void ToggleCheckBox(GridDataItem dataItem, bool toggleValue)
 {
     var rowCheckBox = (CheckBox)dataItem.FindControl("rowCheckBox");
     if (rowCheckBox.Visible)
     {
         rowCheckBox.Checked = toggleValue;
         dataItem.Selected = toggleValue;
     }
 }
 private void adicionarExtension(GridDataItem g)
 {
     Consulta c = new Consulta();
     Int16 idExtension = Convert.ToInt16(g.GetDataKeyValue("value"));
     string codArchivo = ViewState["CodArchivo"].ToString();
     if (c.consultarExtensionXarchivoOBJ(codArchivo, idExtension) == null)
     {
         ExtensionXarchivo e = new ExtensionXarchivo();
         RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta();
         InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name));
         try
         {
             e.extension = c.consultarExtensionesOBJ(idExtension);
             e.archivo = c.consultarArchivoParametrizado(codArchivo);
             i.IUDextensionXarchivo(e, 2);
             this.RadWindowManager1.RadAlert("Extension agregada correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
                 null, Utilities.pathImageMessage(TypeMessage.information_message));
             cargarGrilla2();
         }
         catch (Exception ex)
         {
             Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex);
             this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.error_message),
                 null, Utilities.pathImageMessage(TypeMessage.error_message));
         }
     }
     else
     {
         this.RadWindowManager1.RadAlert("La extension ya se encuentra asociada al archivo seleccionado", 400, 200, Utilities.windowTitle(TypeMessage.information_message),
             null, Utilities.pathImageMessage(TypeMessage.information_message));
     }
 }