rad dock issue

1 posts, 0 answers
  1. mahendren
    mahendren avatar
    4 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2011 Link to this post

    Requirements

    RadControls version

     

    .NET version 2.0

     

    Visual Studio version 2.0

     

    programming language     c#

     

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    [enter description here, together with step-by-step instructions on how to use the project]


    hi,

    when load docks from database ,not above to move one zone to another.if i change the docks means not update save docks and load dock states ..........How to manage raddockstate and Search emplayee wise add new docks dynamically emplayee wise 
    Update & delete , and drag & drop one raddockzone to another ...................help me...........


    following is my sample code

    using

     

    System;

     

    using

     

    System.Web;

     

    using

     

    System.Web.UI;

     

    using

     

    System.Web.UI.WebControls;

     

    using

     

    System.Data;

     

    using

     

    System.Configuration;

     

    using

     

    System.Web.Security;

     

    using

     

    System.Web.UI.WebControls.WebParts;

     

    using

     

    System.Web.UI.HtmlControls;

     

    using

     

    Telerik.Web.UI;

     

    using

     

    System.Collections.Generic;

     

    public

     

    partial class Default : MediReckonerTemplate

     

    {

     

    string PracticeCode = "1";

     

     

    string UserCode = "1";

     

     

    string connectionString="";

     

     

    string dbType = "";

     

     

    private bool _dockStateCleared = false;

     

     

    protected void Page_Load(object sender, EventArgs e)

     

    {

     

    if (!IsPostBack)

     

    {

    LoadddlUnits();

     

    if (Request.QueryString["DoctorCode"] + "" != "" && Request.QueryString["PracticeCode"] + "" != "")

     

    {

    PracticeCode = Request.QueryString[

    "PracticeCode"] + "";

     

    }

    Session[

    "UserCode"] = UserCode;

     

    Session[

    "PracticeCode"] = PracticeCode;

     

    practiceInfo(PracticeCode);

    LOADDOCTOR();

     

    DBHelperClass.SelectValueInDropDownList(ddl_Doctor, Session["DoctorCode"] + "");

     

    }

    }

     

    void practiceInfo(string practiceCode)

     

    {

    localhost.

    AicsCommonWebService aicsService = new localhost.AicsCommonWebService();

     

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

     

    DataSet connDet = aicsService.GetPracticeConnectionStringInit(practiceCode);

     

     

    if (connDet.Tables[0].Rows.Count == 0)

     

     

    return;

     

    connectionString = connDet.Tables[0].Rows[0][

    "ConnectionString"] + "";

     

    dbType = connDet.Tables[0].Rows[0][

    "DbType"] + "";

     

     

     

    HttpContext.Current.Session["HS"] = practiceCode;

     

    myMedClass.SaveSessionDefaultValues(

    "ConnectionString", connectionString);

     

    myMedClass.SaveSessionDefaultValues(

    "dbType", dbType);

     

    }

     

    void LoadddlUnits()

     

    {

     

    DBHelperClass cls = new DBHelperClass();

     

     

    string Loadddl = DBHelperClass.GetSQLQuery("TEMPLATEMASTER", "");

     

    cls.LoadComboBox(ddl_Template, Loadddl,

    "Select", false);

     

    cls =

    null;

     

    ddl_Units.Items.Clear();

    }

     

    void LOADDOCTOR()

     

    {

     

    DBHelperClass cls = new DBHelperClass();

     

     

    string Loadddldoctor = DBHelperClass.GetSQLQuery("DOCTORMASTER", "");

     

    cls.LoadComboBox(ddl_Doctor, Loadddldoctor,

    "", false);

     

    cls =

    null;

     

    }

     

    void loaddock()

     

    {

    CurrentDockStates.Clear();

    _dockStateCleared =

    true;

     

     

    DBHelperClass.SelectValueInDropDownList(ddl_Doctor, Session["DoctorCode"] + "");

     

     

    if (ddl_Doctor.SelectedIndex > 0 || Session["DoctorCode"] + ""!="")

     

    {

     

    string Query = "";

     

     

    if (Session["DoctorCode"] + "" != "")

     

    Query =

    "Select * from PatientDashBoardConfig Where Active = '1' and DoctorMasterSequenceNumber = '" + Session["DoctorCode"] + "" + "' and HospitalSequenceNumber = '" + Session["PracticeCode"] + "" + "' order by orderby";

     

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

     

    DataSet ds = myMedClass.executeDataSet(Query);

     

     

    if (ds.Tables[0].Rows.Count > 0)

     

    {

     

    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

     

    {

     

    RadDock dock1 = CreateRadDock(ds.Tables[0].Rows[i]["DashboardCaption"] + "", ds.Tables[0].Rows[i]["DashboardSequenceNumber"] + "");

     

     

    //UpdatePanel1.ContentTemplateContainer.Controls.Add(dock1);

     

    Radpane1.Width =

    Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i]["panal1"] + ""));

     

    Radpane2.Width =

    Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i]["panal2"] + ""));

     

     

    switch (ds.Tables[0].Rows[i]["DockzoneCaption"] + "")

     

    {

     

    case "RadDockZone1":

     

    RadDockZone1.Controls.Add(dock1);

     

    break;

     

     

    case "RadDockZone2":

     

    RadDockZone2.Controls.Add(dock1);

     

    break;

     

    }

    }

    }

    }

    }

     

    protected void ddl_Units_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

     

    {

     

    if (ddl_Units.SelectedIndex > 0&&ddl_Doctor.SelectedIndex>0)

     

    {

    loaddock();

     

    int i = 0;

     

     

    if (CurrentDockStates.Count > 0)

     

    {

    i = CurrentDockStates.Count;

    }

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

    localhost.

    DoctorWebService CCHIT = new localhost.DoctorWebService();

     

     

    DataSet ds = CCHIT.GetPatientDashboard();

     

    dbType = myMedClass.GetValuesFromDefaultSession(

    "dbType") + "";

     

    connectionString =

    ConfigurationManager.AppSettings["ConnectionString"] + "";

     

     

    string[] values = { PracticeCode, "0", ddl_Units.SelectedItem.Text, ddl_Doctor.SelectedValue.ToString(), "RadDockZone1" , Radpane1.Width.Value.ToString(), Radpane2.Width.Value.ToString() , i.ToString(), "1", UserCode, "" };

     

    myMedClass.setValuesToDataTable(ds.Tables[

    "PatientDashboard"], values);

     

     

    string code = CCHIT.SavePatientDashboard(dbType, PracticeCode, connectionString, ds);

     

     

     

    RadDock dock = CreateRadDock(ddl_Units.SelectedItem.Text,code);

     

     

    //UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);

     

    RadDockZone1.Controls.Add(dock);

    }

    }

     

    private List<DockState> CurrentDockStates

     

    {

     

    get

     

    {

     

    //Store the info about the added docks in the session. For real life

     

     

    // applications we recommend using database or other storage medium

     

     

    // for persisting this information.

     

     

    List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesDynamicDocks"];

     

     

    if (Object.Equals(_currentDockStates, null))

     

    {

    _currentDockStates =

    new List<DockState>();

     

    Session[

    "CurrentDockStatesDynamicDocks"] = _currentDockStates;

     

    }

     

    return _currentDockStates;

     

    }

     

    set

     

    {

    Session[

    "CurrentDockStatesDynamicDocks"] = value;

     

    }

    }

     

    private RadDock CreateRadDockFromState(DockState state)

     

    {

     

    RadDock dock = new RadDock();

     

    dock.DockMode =

    DockMode.Docked;

     

    dock.ID =

    string.Format("RadDock{0}", state.UniqueName);

     

    dock.Style.Add(

    "padding", "3px 15px 3px 0px");

     

    dock.EnableAnimation =

    true;

     

    dock.EnableRoundedCorners =

    true;

     

    dock.Resizable =

    true;

     

    dock.ApplyState(state);

    dock.Commands.Add(

    new DockCloseCommand());

     

    dock.Command +=

    new DockCommandEventHandler(dock_Command);

     

     

    return dock;

     

    }

     

    void dock_Command(object sender, DockCommandEventArgs e)

     

    {

     

    if (e.Command.Name == "Close")

     

    {

     

    ScriptManager.RegisterStartupScript(UpdatePanel1,this.GetType(),"RemoveDock",string.Format(@"function _removeDock() {{ Sys.Application.remove_load(_removeDock);$find('{0}').undock(); $get('{1}').appendChild($get('{0}')); $find('{0}').doPostBack('DockPositionChanged');}};Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID),true);

     

    }

    }

     

    private RadDock CreateRadDock(string Name,string ID)

     

    {

     

    int docksCount = CurrentDockStates.Count;

     

     

    RadDock dock = new RadDock();

     

    dock.DockMode =

    DockMode.Docked;

     

    dock.UniqueName = ID.ToString();

    dock.ID =

    string.Format("RadDock{0}", dock.UniqueName);

     

    dock.Title = Name;

    dock.Text = Name;

    dock.EnableAnimation =

    true;

     

    dock.EnableRoundedCorners =

    true;

     

    dock.Resizable =

    true;

     

    dock.Style.Add(

    "padding", "3px 15px 3px 0px");

     

    dock.Width =

    Unit.Pixel(300);

     

    dock.Commands.Add(

    new DockCloseCommand());

     

    dock.Command +=

    new DockCommandEventHandler(dock_Command);

     

     

    return dock;

     

    }

     

    private void CreateSaveStateTrigger(RadDock dock)

     

    {

     

    //Ensure that the RadDock control will initiate postback

     

     

    //when its position changes on the client or any of the commands is clicked.

     

     

    //Using the trigger we will "ajaxify" that postback.

     

    dock.AutoPostBack =

    true;

     

    dock.CommandsAutoPostBack =

    true;

     

    dock.Style.Add(

    "zIndex", "0");

     

     

     

    AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();

     

    saveStateTrigger.ControlID = dock.ID;

    saveStateTrigger.EventName =

    "DockPositionChanged";

     

     

    UpdatePanel1.Triggers.Add(saveStateTrigger);

    saveStateTrigger =

    new AsyncPostBackTrigger();

     

    saveStateTrigger.ControlID = dock.ID;

    saveStateTrigger.EventName =

    "Command";

     

    UpdatePanel1.Triggers.Add(saveStateTrigger);

    }

     

    protected override void OnInit(EventArgs e)

     

    {

     

    //for (int i = 0; i < CurrentDockStates.Count; i++)

     

     

    //{

     

     

    // if (CurrentDockStates[i].Closed == false)

     

     

    // {

     

     

    // RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);

     

     

    // RadDockLayout1.Controls.Add(dock);

     

     

    // CreateSaveStateTrigger(dock);

     

     

    // }

     

     

    //}

     

    CurrentDockStates.Clear();

     

    DBHelperClass.SelectValueInDropDownList(ddl_Doctor, Session["DoctorCode"] + "");

     

     

    if (ddl_Doctor.SelectedIndex > 0 || Session["DoctorCode"] + ""!="")

     

    {

     

    string Query = "";

     

     

    if (Session["DoctorCode"] + "" != "")

     

    Query =

    "Select * from PatientDashBoardConfig Where Active = '1' and DoctorMasterSequenceNumber = '" + Session["DoctorCode"] + "" + "' and HospitalSequenceNumber = '" + Session["PracticeCode"] + "" + "' order by orderby";

     

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

     

    DataSet ds = myMedClass.executeDataSet(Query);

     

     

    if (ds.Tables[0].Rows.Count > 0)

     

    {

     

    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

     

    {

     

     

    //{

     

     

    //if (CurrentDockStates[i].Closed == false)

     

    Radpane1.Width =

    Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i]["panal1"] + ""));

     

    Radpane2.Width =

    Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i]["panal2"] + ""));

     

     

    //if(CurrentDockStates.Count>0)

     

    {

     

    RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);

     

    RadDockLayout1.Controls.Add(dock);

    CreateSaveStateTrigger(dock);

    }

    }

    }

    }

    }

     

     

    protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)

     

    {

     

    //Populate the event args with the state information. The RadDockLayout control

     

     

    // will automatically move the docks according that information.

     

     

    foreach (DockState state in CurrentDockStates)

     

    {

    e.Positions[state.UniqueName] = state.DockZoneID;

    e.Indices[state.UniqueName] = state.Index;

    }

    }

     

    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)

     

    {

     

    //Save the dock state in the page Session. This will enable us

     

     

    // to recreate the dock in the next Page_Init.

     

     

    if (ddl_Doctor.SelectedIndex > 0)

     

    {

     

    if (!_dockStateCleared)

     

    {

    CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();

     

    foreach (DockState dock in CurrentDockStates)

     

    {

     

    if (dock.Closed == true)

     

    {

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

     

    string Query = "Delete from Patientdashboardconfig Where DashboardSequenceNumber = '" + dock.UniqueName + "' and DoctorMasterSequenceNumber = '" + ddl_Doctor.SelectedValue.ToString() + "' and HospitalSequenceNumber = '" + PracticeCode + "'";

     

    myMedClass.ExecuteNonQuery(Query);

    }

     

    if (dock.Closed == false)

     

    {

     

    if (myMedClass == null) myMedClass = new MediReckonerCommonClass();

     

    localhost.

    DoctorWebService CCHIT = new localhost.DoctorWebService();

     

     

    DataSet ds = CCHIT.GetPatientDashboard();

     

    dbType =

    ConfigurationManager.AppSettings["dbtype"] + "";

     

    connectionString =

    ConfigurationManager.AppSettings["ConnectionString"] + "";

     

     

    string[] values = { PracticeCode, dock.UniqueName, dock.Text, ddl_Doctor.SelectedValue.ToString(), dock.DockZoneID.ToString(), Radpane1.Width.Value.ToString(), Radpane2.Width.Value.ToString(), dock.Index.ToString(), "1", UserCode, "" };

     

    myMedClass.setValuesToDataTable(ds.Tables[

    "PatientDashboard"], values);

     

     

    string code = CCHIT.SavePatientDashboard(dbType, PracticeCode, connectionString, ds);

     

    }

    }

    }

    }

    }

     

    protected void lnkButSave_Click(object sender, EventArgs e)

     

    {

    Response.Redirect(

    "ViewDashBoard.aspx");

     

    }

     

    protected void ddl_Template_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

     

    {

    loaddock();

     

    if (ddl_Template.SelectedIndex > 0)

     

    {

     

    string Loadddl = DBHelperClass.GetSQLQuery("UNITMASTER", "TemplateRefNo='" + ddl_Template.SelectedValue + "'");

     

     

    DBHelperClass cls = new DBHelperClass();

     

    cls.LoadComboBox(ddl_Units, Loadddl,

    "Select", false);

     

    cls =

    null;

     

     

    string[] str = { "Allergy", "Cheif Complient", "Medications", "New Prescription", "Vitals", "Impressions", "Plan", "Plan - Prescription", "Plan - Lab", "Plan - Procedure", "Plan - Rediology", "Plan - Followups", "Plan - Discharge" };

     

     

    foreach (string str1 in str)

     

    {

    ddl_Units.Items.Add(

    new RadComboBoxItem(str1));

     

    }

    }

    }

     

    protected void ddl_Doctor_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

     

    {

    Session[

    "DoctorCode"] = ddl_Doctor.SelectedValue.ToString();

     

    ddl_Units.Items.Clear();

    ddl_Template.SelectedIndex = 0;

    loaddock();

    }

    }

     



    by
    Mahe
Back to Top