Ejemplo n.º 1
0
        public JsonResult UpdateLang(clsLanguage _lang)
        {
            tblLanguage lang = useroper.GetByID(_lang.Id);

            lang.Language = _lang.LangName;
            useroper.Edit(lang);
            useroper.Save();

            return(Json(lang));
        }
Ejemplo n.º 2
0
        public JsonResult InsertLang(clsLanguage _lang)
        {
            tblLanguage lang = new tblLanguage();

            lang.Language  = _lang.LangName;
            lang.IsActive  = true;
            lang.IsDeleted = true;
            useroper.Insert(lang);
            useroper.Save();

            return(Json(lang));
        }
Ejemplo n.º 3
0
 protected void BindDetail(string id)
 {
     #region Variable
     var strSQL = new StringBuilder();
     var dt     = new DataTable();
     #endregion
     #region Procedure
     #region SQL Query
     strSQL.Append("SELECT ");
     strSQL.Append("A.Name,A.NameEN,");
     strSQL.Append("A.Detail,A.DetailEN,");
     strSQL.Append("A.Content,A.ContentEN,");
     strSQL.Append("A.Sort,");
     strSQL.Append("A.StatusFlag ");
     strSQL.Append("FROM ");
     strSQL.Append(tableDefault + " A ");
     strSQL.Append("WHERE ");
     strSQL.Append("A.UID=" + parameterChar + "ID");
     #endregion
     dt = clsSQL.Bind(strSQL.ToString(), new string[, ] {
         { parameterChar + "ID", id }
     });
     if (dt != null && dt.Rows.Count > 0)
     {
         vdPhoto.Enabled = false;
         var clsLanguage = new clsLanguage();
         txtName.Text     = dt.Rows[0]["Name"].ToString();
         txtDetail.Text   = dt.Rows[0]["Detail"].ToString();
         ucContent.Text   = dt.Rows[0]["Content"].ToString();
         txtNameEN.Text   = dt.Rows[0]["NameEN"].ToString();
         txtDetailEN.Text = dt.Rows[0]["DetailEN"].ToString();
         ucContentEN.Text = dt.Rows[0]["ContentEN"].ToString();
         txtSort.Text     = dt.Rows[0]["Sort"].ToString();
         cbActive.Checked = (dt.Rows[0]["StatusFlag"].ToString() == "A" ? true : false);
     }
     else
     {
         ucColorBox1.Redirect("/Management/" + webDefault, "ไม่พบหน้าเว็บที่คุณต้องการ");
     }
     #endregion
 }
Ejemplo n.º 4
0
        public bool DesignGridFromDataTable(DataTable tableToBeDesigned, ref string strErr)
        {
            try
            {
                //Changing For New Component
               // _BSource = new BindingSource(tableToBeDesigned, null);

                this.AutoGenerateColumns = false;
                strProcName = null;
                intColCount = tableToBeDesigned.Columns.Count;
                strColNames = new string[intColCount];
                string[] strHeadings = new string[intColCount];
                for (int i = 0; i < intColCount; i++)
                {
                    strColNames[i] = tableToBeDesigned.Columns[i].ColumnName;
                }

                #region Comments
                ////**** Creating the Header text by replacing the Underscore(_)
                ////**** Symbol with the Space ( ).
                #endregion Comments
                #region Header Text
                for (int i = 0; i < intColCount; i++)
                {
                    string tmp = "";
                    string[] m_strSplit = strColNames[i].Split(new char[] { '_' }, strColNames[i].Length);
                    for (int m = 0; m <= m_strSplit.GetUpperBound(0); m++)
                        tmp = tmp.Trim() + " " + m_strSplit[m].Trim();
                    strHeadings[i] = tmp;

                    if (strLangID != null)
                    {
                        if (strLangID.Length >= intColCount)
                        {
                            clsLanguage objLang = new clsLanguage();

                            string strTmp = objLang.LanguageString(strLangID[i]);
                            if (strTmp == "*****")
                                strHeadings[i] = "** " + strHeadings[i];
                            else
                                strHeadings[i] = strTmp;

                            objLang.Dispose();
                        }
                        else
                        {
                            if (strLangID.Length > i)
                            {
                                clsLanguage objLang = new clsLanguage();
                                string strTmp = objLang.LanguageString(strLangID[i]);

                                if (strTmp == "*****")
                                    strHeadings[i] = "** " + strHeadings[i];
                                else
                                    strHeadings[i] = strTmp;

                                objLang.Dispose();
                            }
                            else
                            {
                                strHeadings[i] = "** " + strHeadings[i];
                            }
                        }
                    }
                    else
                    {
                        strHeadings[i] = "** " + strHeadings[i];
                    }
                }

                #endregion
                ////**** Creating a new Table Style to include the TextBoxes in the Datagrid

                ////**** If the Default design is false then setting Colors for that Grid
                //Changing For New Component
                //this.DataSource = _BSource;

                this.DataSource = tableToBeDesigned;
                //this.DataSource = tableToBeDesigned;
                #region Set Default Not in Use
                if (SetDefault == true)
                {

                    //DataGridViewCellStyle headerstyle = new DataGridViewCellStyle();
                    //headerstyle.BackColor = System.Drawing.Color.Linen;
                    //headerstyle.ForeColor = System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;
                    //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle);

                }
                else
                {
                    //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue;
                    //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;

                }
                #endregion Set Default Not in Use
                ////**** To incorporate the Font the in DataGrid Cell.

                intVisibleColumnCount = 0;
                for (int i = 0; i < intColCount; i++)
                {
                    if (strColNames[i].ToUpper().IndexOf("MASK") == 0)
                        continue;

                    intVisibleColumnCount++;

                    DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn();
                    dgTBCol.DataPropertyName = tableToBeDesigned.Columns[i].ColumnName;
                    dgTBCol.HeaderText = strHeadings[i];
                    this.Columns.Add(dgTBCol);

                }
                //BindingCompleted = true;
                //this.Font = new Font(this.Font, FontStyle.Regular);

                this.AutoSize = true;
               // clsReadOnlyGrid_BindingContextChanged(null, null);
                return true;
            }
            catch (Exception ex)
            {
                strErr = ex.Message + " - " + ex.Source;
                return false;
            }
        }
Ejemplo n.º 5
0
        public bool DesignGridFromSQL(string sqlParam, ref string strErr)
        {
            try
            {
                strSQL = sqlParam;

                Query objQuery = new Query();

                DataSet ds = objQuery.ExecuteQueryCommand(strSQL);

                dtReadOnlyGrid = ds.Tables[0].Copy();
                dtReadOnlyGrid.TableName = "Table";
                ds.Dispose();
                //Changing For New Component
                //_BSource = new BindingSource(dtReadOnlyGrid, null);

                intColCount = dtReadOnlyGrid.Columns.Count;
                strColNames = new string[intColCount];

                for (int i = 0; i < intColCount; i++)
                    strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName;

               ///***Displaying data from a Table to a Grid and aligning the Columns***
                intColCount = dtReadOnlyGrid.Columns.Count;
                strColNames = new string[intColCount];

                for (int i = 0; i < intColCount; i++)
                    strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName;

                string[] strHeadings = new string[intColCount];

                ////**** Creating the Header text by replacing the Underscore(_)
                ////**** Symbol with the Space ( ).

                clsLanguage objLang = new clsLanguage();

                for (int i = 0; i < intColCount; i++)
                {
                    strHeadings[i] = strColNames[i].Replace("_", " ");

                    if (strLangID != null && strColNames[i].IndexOf("MASK_") < 0)
                    {
                        if (strLangID.Length >= intColCount)
                        {
                            string strTmp = objLang.LanguageString(strLangID[i]);
                            if (strTmp == "*****")
                                strHeadings[i] = "** " + strHeadings[i];
                            else
                                strHeadings[i] = strTmp;
                        }
                        else
                        {
                            if (strLangID.Length > i)
                            {
                                string strTmp = objLang.LanguageString(strLangID[i]);

                                if (strTmp == "*****")
                                    strHeadings[i] = "** " + strHeadings[i];
                                else
                                    strHeadings[i] = strTmp;
                            }
                            else
                            {
                                strHeadings[i] = "** " + strHeadings[i];
                            }
                        }
                    }
                    else
                    {
                        strHeadings[i] = "** " + strHeadings[i];
                    }
                }

                if (objLang != null)
                    objLang.Dispose();

                ////**** Creating a new Table Style to include the TextBoxes in the Datagrid
                //this.DataSource =_BSource;
                this.DataSource = dtReadOnlyGrid;
                if (SetDefault == true)
                {

                    //DataGridViewCellStyle headerstyle = new DataGridViewCellStyle();
                    //headerstyle.BackColor = System.Drawing.Color.Linen;
                    //headerstyle.ForeColor = System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;
                    //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle);

                }
                else
                {
                    //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue;
                    //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;

                }

                ////**** To incorporate the Font the in DataGrid Cell.

                intVisibleColumnCount = 0;
                if (this.Columns.Count > 0)
                {
                    this.Columns.Clear();
                }
                for (int i = 0; i < intColCount; i++)
                {
                    if (strColNames[i].ToUpper().IndexOf("MASK") == 0)
                        continue;

                    intVisibleColumnCount++;

                    DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn();
                    dgTBCol.DataPropertyName = dtReadOnlyGrid.Columns[i].ColumnName;
                    dgTBCol.HeaderText = strHeadings[i];
                    this.Columns.Add(dgTBCol);

                }
                //*****************************
                AutoSizeCol();
                if (boolLevelSearch == true)
                {
                    //this.KeyDown += new KeyEventHandler(BackSpaceKeyDown);
                    arlHierarchyLevel = new ArrayList();
                    arlHierarchyValue = new ArrayList();
                    arlPrimKey = new ArrayList();
                }
                this.AllowSorting = true;
                //***************************
                //BindingCompleted = true;
                clsReadOnlyGrid_BindingContextChanged(null, null);
                //this.Font = new Font(this.Font, FontStyle.Regular);
               // this.AutoSize = true;
                return true;
            }
            catch (Exception ex)
            {
                strErr = ex.Message + " - " + ex.Source;
                return false;
            }
        }
    private string CenterBuilder()
    {
        #region Variable
        clsDefault  clsDefault  = new clsDefault();
        clsSQL      clsSQL      = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();

        StringBuilder strSQL    = new StringBuilder();
        StringBuilder strCenter = new StringBuilder();
        DataTable     dtGroup   = new DataTable();
        DataTable     dt        = new DataTable();
        #endregion
        #region MedicalCenterGroup : SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("MedicalCenterGroup.UID,");
        strSQL.Append("MedicalCenterGroup.Name ");
        strSQL.Append("FROM ");
        strSQL.Append("MedicalCenterGroup ");
        strSQL.Append("INNER JOIN Language ON MedicalCenterGroup.LanguageUID=Language.UID AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("MedicalCenterGroup.Active='1' ");
        strSQL.Append("AND Language.Name='" + clsLanguage.LanguageCurrent + "' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("MedicalCenterGroup.Sort");
        #endregion

        dtGroup       = clsSQL.Bind(strSQL.ToString(), dbType, cs);
        strSQL.Length = 0; strSQL.Capacity = 0;

        strCenter.Append("<div style='padding:0 10px 0 10px;width:400px;'>");
        if (dtGroup != null && dtGroup.Rows.Count > 0)
        {
            for (int i = 0; i < dtGroup.Rows.Count; i++)
            {
                strCenter.Append("<h4>" + dtGroup.Rows[i]["Name"].ToString() + "</h4>");

                #region MedicalCenter
                #region MedicalCenter : SQL Query
                strSQL.Append("SELECT ");
                //strSQL.Append("UID,");
                strSQL.Append("DepartmentUID UID,");
                strSQL.Append("Name ");
                strSQL.Append("FROM ");
                strSQL.Append("MedicalCenter ");
                strSQL.Append("WHERE ");
                strSQL.Append("MedicalCenterGroupUID=" + dtGroup.Rows[i]["UID"].ToString() + " ");
                strSQL.Append("AND Active='1' ");
                #endregion

                dt            = clsSQL.Bind(strSQL.ToString(), dbType, cs);
                strSQL.Length = 0; strSQL.Capacity = 0;

                if (dt != null && dt.Rows.Count > 0)
                {
                    strCenter.Append("<table cellpadding='0' cellspacing='0'>");
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        if ((j + 1) % 2 != 0)
                        {
                            strCenter.Append("<tr>");
                            strCenter.Append("<td style='width:200px;'>");
                            strCenter.Append("<a href='/MedicalCenter/" + dt.Rows[j]["UID"].ToString() + "/" + clsDefault.URLRoutingFilter(dt.Rows[j]["Name"]) + "/'>");
                            strCenter.Append(dt.Rows[j]["Name"].ToString());
                            strCenter.Append("</a>");
                            strCenter.Append("</td>");
                        }
                        else
                        {
                            strCenter.Append("<td style='width:200px;'>");
                            strCenter.Append("<a href='/MedicalCenter/" + dt.Rows[j]["UID"].ToString() + "/" + clsDefault.URLRoutingFilter(dt.Rows[j]["Name"]) + "/'>");
                            strCenter.Append(dt.Rows[j]["Name"].ToString());
                            strCenter.Append("</a>");
                            strCenter.Append("</td>");
                            strCenter.Append("</tr>");
                        }
                    }
                    if (dt.Rows.Count % 2 != 0)
                    {
                        strCenter.Append("<td style='width:200px;'>");
                        strCenter.Append("</td>");
                        strCenter.Append("</tr>");
                    }
                    strCenter.Append("</table>");

                    dt = null;
                }
                else
                {
                    strCenter.Append("<div style='text-align:center;'>-</div>");
                }
                #endregion
            }
        }
        else
        {
            strCenter.Append("-");
        }
        strCenter.Append("</div>");

        /*
         *
         *
         * strCenter.Append("<tr>");
         * strCenter.Append("<td style='width:200px;'>");
         * strCenter.Append("<a href='/Center/" + dt.Rows[i]["MedicalCenterUID"].ToString() + "/" + dt.Rows[i]["MedicalCenterName"].ToString() + "/'>");
         * strCenter.Append(dt.Rows[i]["MedicalCenterName"].ToString());
         * strCenter.Append("</a>");
         * strCenter.Append("</td>");
         * strCenter.Append("<td style='width:200px;'>");
         * strCenter.Append("<a href='/Center/" + dt.Rows[i]["MedicalCenterUID"].ToString() + "/" + dt.Rows[i]["MedicalCenterName"].ToString() + "/'>");
         * strCenter.Append(dt.Rows[i]["MedicalCenterName"].ToString());
         * strCenter.Append("</a>");
         * strCenter.Append("</td>");
         * strCenter.Append("</tr>");
         *
         *
         */
        return(strCenter.ToString());
    }
Ejemplo n.º 7
0
        public bool DesignGrid(string strProcedureName, ref string strErr)
        {
            try
            {
                this.AutoGenerateColumns = false;
                strProcName = strProcedureName;

                Query objQuery = new Query();

                if (ProcParamNames.Count > 0)
                {
                    string[] arrStrProcParamNames = new string[ProcParamNames.Count];
                    string[] arrStrProcParamValues = new string[ProcParamNames.Count];
                    for (int i = 0; i < ProcParamNames.Count; i++)
                    {
                        arrStrProcParamNames[i] = ProcParamNames[i].ToString();
                        arrStrProcParamValues[i] = ProcParamValues[i].ToString();
                    }
                    objQuery.SetInputParameterNames(strProcedureName, arrStrProcParamNames);
                    objQuery.SetInputParameterValues(arrStrProcParamValues);
                }
                objQuery.SetOutputParameterNames(strProcedureName, "CRITERIA");

                DataSet ds = objQuery.ExecuteQueryProcedure(strProcedureName);

                dtReadOnlyGrid = ds.Tables[0].Copy();
                ds.Dispose();
                //Changing For New Component
                //_BSource = new BindingSource(dtReadOnlyGrid, null);
                intColCount = dtReadOnlyGrid.Columns.Count;
                strColNames = new string[intColCount];

                for (int i = 0; i < intColCount; i++)
                    strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName;

                string[] strHeadings = new string[intColCount];

                ////**** Creating the Header text by replacing the Underscore(_)
                ////**** Symbol with the Space ( ).

                clsLanguage objLang = new clsLanguage();

                for (int i = 0; i < intColCount; i++)
                {
                    strHeadings[i] = strColNames[i].Replace("_", " ");

                    if (strLangID != null && strColNames[i].IndexOf("MASK_") < 0)
                    {
                        if (strLangID.Length >= intColCount)
                        {
                            string strTmp = objLang.LanguageString(strLangID[i]);
                            if (strTmp == "*****")
                                strHeadings[i] = "** " + strHeadings[i];
                            else
                                strHeadings[i] = strTmp;
                        }
                        else
                        {
                            if (strLangID.Length > i)
                            {
                                string strTmp = objLang.LanguageString(strLangID[i]);

                                if (strTmp == "*****")
                                    strHeadings[i] = "** " + strHeadings[i];
                                else
                                    strHeadings[i] = strTmp;
                            }
                            else
                            {
                                strHeadings[i] = "** " + strHeadings[i];
                            }
                        }
                    }
                    else
                    {
                        strHeadings[i] = "** " + strHeadings[i];
                    }
                }

                if (objLang != null)
                    objLang.Dispose();

                ////**** If the Default design is false then setting Colors for that Grid

                //this.reEntrent = true;
                //Changing For New Component
               // this.DataSource = dtReadOnlyGrid;
                //this.DataSource = dtReadOnlyGrid;
                //this.reEntrent = false;
                if (SetDefault == true)
                {

                    //DataGridViewCellStyle headerstyle=new DataGridViewCellStyle();
                    //headerstyle.BackColor= System.Drawing.Color.Linen;
                    //headerstyle.ForeColor=System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;
                    //this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle);

                }
                else
                {
                    //this.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.LightSteelBlue;
                    //this.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Navy;
                    //this.GridColor = System.Drawing.Color.Silver;

                }

                ////**** To incorporate the Font the in DataGrid Cell.

                 intVisibleColumnCount = 0;
                 if (this.Columns.Count > 0)
                 {
                     this.Columns.Clear();
                 }
                for (int i = 0; i < intColCount; i++)
                {
                    if (strColNames[i].ToUpper().IndexOf("MASK") == 0)
                        continue;

                    intVisibleColumnCount++;
                    DataGridViewTextBoxColumn dgTBCol = new DataGridViewTextBoxColumn();
                    dgTBCol.DataPropertyName = dtReadOnlyGrid.Columns[i].ColumnName;
                    dgTBCol.HeaderText = strHeadings[i];
                    this.Columns.Add(dgTBCol);

                    //this.Columns[this.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet;

                }
                //Changing For New Component
                //BindingCompleted = true;
                //clsReadOnlyGrid_BindingContextChanged(null, null);
               // this.Font = new Font(this.Font, FontStyle.Regular);
                this.ScrollBars = ScrollBars.Both;
                //this.AutoSize = true;
                this.DataSource = dtReadOnlyGrid;
                return true;
            }
            catch (Exception ex)
            {
                strErr = ex.Message + " - " + ex.Source;
                //return false;
                if (strErr == "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function. - System.Windows.Forms")
                {
                    strErr = "";
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
    private void SliderBuilder()
    {
        #region Variable
        clsDefault clsDefault = new clsDefault();
        clsSQL clsSQL = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();

        StringBuilder strSQL = new StringBuilder();
        StringBuilder strSliderItem = new StringBuilder();
        StringBuilder strOutput = new StringBuilder();
        StringBuilder strScript = new StringBuilder();
        DataTable dt = new DataTable();
        bool foundChecker = false;
        string languageDefault = "";
        #endregion

        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("Language.Name LanguageName,");
        strSQL.Append("Slider.Photo,");
        strSQL.Append("Slider.Name ");
        strSQL.Append("FROM ");
        strSQL.Append("Slider ");
        strSQL.Append("INNER JOIN Language ON ");
        strSQL.Append("Slider.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("Slider.Active='1' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC,Slider.Sort ASC");
        #endregion

        dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);

        if (dt != null && dt.Rows.Count > 0)
        {
            #region Find Language
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i == 0) languageDefault = dt.Rows[i]["LanguageName"].ToString();
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    foundChecker = true;

                    strSliderItem.Append("<li>");
                    strSliderItem.Append("<img src='" + dt.Rows[i]["Photo"].ToString() + "' ");
                    strSliderItem.Append("alt='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "' ");
                    strSliderItem.Append("title='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "'/>");
                    strSliderItem.Append("</li>");
                }

            }
            #endregion
            #region Default Language
            if (!foundChecker)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["LanguageName"].ToString() == languageDefault)
                    {
                        strSliderItem.Append("<li>");
                        strSliderItem.Append("<img src='" + dt.Rows[i]["Photo"].ToString() + "' ");
                        strSliderItem.Append("alt='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "' ");
                        strSliderItem.Append("title='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "'/>");
                        strSliderItem.Append("</li>");
                    }
                }
            }
            #endregion
            #region div Builder
            strOutput.Append("<div id='Slider' style='display:block;width:" + _width + ";height:" + _height + ";overflow:hidden;'>");
            strOutput.Append("<ul class='bjqs'>");
            strOutput.Append(strSliderItem.ToString());
            strOutput.Append("</ul>");
            strOutput.Append("</div>");
            #endregion
        }
        else
        {
            strOutput.Append("");
        }

        lblSlider.Text = strOutput.ToString();
    }
Ejemplo n.º 9
0
    /// <summary>
    /// ส่งเมล์จาก EmailTemplate โดยระบุค่าตัวแปรได้
    /// </summary>
    /// <param name="TemplateName">ชื่อ Template</param>
    /// <param name="From">เมล์ต้นทาง</param>
    /// <param name="To">เมล์ปลายทาง</param>
    /// <param name="Parameter">ค่าที่ใช้แทนในเมล์ เช่น [Username],nithi.re</param>
    /// <param name="outMessage">ข้อความแจ้งเตือนเมื่อเกิดข้อผิดพลาด</param>
    /// <param name="FromAliasName">ชื่อเมล์ต้นทาง</param>
    /// <param name="Cc">เมล์แนบ</param>
    /// <param name="Bcc">เมล์ไม่เปิดเผย</param>
    /// <param name="Signature">ข้อความท้ายเมล์</param>
    /// <returns>true=ส่งผ่าน , false=ส่งไม่ผ่าน</returns>
    /// <example>
    /// clsMail clsMail=new clsMail();
    /// string outMessage;
    /// clsMail.SendTemplate(
    ///     "UserRegisterConfirm",
    ///     "*****@*****.**",
    ///     "*****@*****.**",
    ///     new string[,] { { "[Username]", "ยูสเซอร์เนม" }, { "[UIDEncrypt]", "ยูไอดีเอ็นคริบ" } },
    ///     out outMessage);
    /// </example>
    public bool SendTemplate(string TemplateName, string From, string To, string[,] Parameter, out string outMessage, string FromAliasName = "", string Cc = "", string Bcc = "", string Signature = "")
    {
        #region Variable
        bool rtnValue = false;
        outMessage = "";

        StringBuilder strSQL = new StringBuilder();
        DataTable dt = new DataTable();
        clsSQL clsSQL = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();
        clsData clsData=new clsData();
        clsDefault clsDefault = new clsDefault();
        #endregion

        #region Found Language
        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("EmailTemplate.UID,Language.Name LanguageName,EmailTemplate.Subject,EmailTemplate.Message ");
        strSQL.Append("FROM ");
        strSQL.Append("EmailTemplate ");
        strSQL.Append("INNER JOIN Language ON EmailTemplate.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        //strSQL.Append("AND Language.Name='" + clsLanguage.LanguageCurrent + "' ");
        strSQL.Append("WHERE ");
        strSQL.Append("EmailTemplate.Active='1' ");
        strSQL.Append("AND EmailTemplate.Name='" + TemplateName + "' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC");
        #endregion

        dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);
        strSQL.Length = 0; strSQL.Capacity = 0;
        #endregion

        if (dt != null && dt.Rows.Count > 0)
        {
            #region Find LanguageRow
            bool languageMatch = false;
            int i;

            for (i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    languageMatch = true;
                    break;
                }
            }
            if (!languageMatch) i = 0;
            #endregion

            #region Parameter Replace
            string subject = dt.Rows[i]["Subject"].ToString();
            string message = dt.Rows[i]["Message"].ToString();

            subject = clsData.Replacer(subject, Parameter);
            message = clsData.Replacer(message, Parameter);

            if (Send(From, To, subject, message, out outMessage, FromAliasName, Cc, Bcc, Signature))
            {
                SendTemplateLog(dt.Rows[i]["UID"].ToString(), From, To, Cc, Bcc, "Complete");
                rtnValue = true;
            }
            else
            {
                SendTemplateLog(dt.Rows[i]["UID"].ToString(), From, To, Cc, Bcc, clsDefault.Left(outMessage,90));
                rtnValue = false;
            }
            #endregion
        }
        else
        {
            outMessage = "ไม่พบข้อมูล EmailTemplate";
            return false;
        }

        return rtnValue;
    }
Ejemplo n.º 10
0
        /// <summary>
        /// Converts the column header texts for language conversion
        /// </summary>
        private void ChangeLanguage()
        {
            try
            {
                string strTmp = "";
                clsLanguage objLang = new clsLanguage();
                for (int i = 0; i < dtSource.Columns.Count; i++)
                {
                    if (strLangID[i] != null)
                    {
                        strTmp = objLang.LanguageString(strLangID[i]);

                        if (strTmp != "*****")
                            strHeadings[i] = strTmp + " ";
                    }

                }
                objLang.Dispose();
            }
            catch (Exception ex)
            {
                string test = ex.Message;
            }
        }
Ejemplo n.º 11
0
        private string GetStringVal(string str)
        {
            string strTemp = "";
            clsLanguage objLang = new clsLanguage();
            strTemp = objLang.LangEngString(str,true);
            objLang.Dispose();

            if(strTemp == "*****")
                return "** " + str;
            else
                return strTemp;
        }
Ejemplo n.º 12
0
    private void SliderBuilder()
    {
        #region Variable
        clsDefault  clsDefault  = new clsDefault();
        clsSQL      clsSQL      = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();

        StringBuilder strSQL          = new StringBuilder();
        StringBuilder strSliderItem   = new StringBuilder();
        StringBuilder strOutput       = new StringBuilder();
        StringBuilder strScript       = new StringBuilder();
        DataTable     dt              = new DataTable();
        bool          foundChecker    = false;
        string        languageDefault = "";
        #endregion

        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("Language.Name LanguageName,");
        strSQL.Append("Slider.Photo,");
        strSQL.Append("Slider.Name ");
        strSQL.Append("FROM ");
        strSQL.Append("Slider ");
        strSQL.Append("INNER JOIN Language ON ");
        strSQL.Append("Slider.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("Slider.Active='1' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC,Slider.Sort ASC");
        #endregion

        dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);

        if (dt != null && dt.Rows.Count > 0)
        {
            #region Find Language
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i == 0)
                {
                    languageDefault = dt.Rows[i]["LanguageName"].ToString();
                }
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    foundChecker = true;

                    strSliderItem.Append("<li>");
                    strSliderItem.Append("<img src='" + dt.Rows[i]["Photo"].ToString() + "' ");
                    strSliderItem.Append("alt='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "' ");
                    strSliderItem.Append("title='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "'/>");
                    strSliderItem.Append("</li>");
                }
            }
            #endregion
            #region Default Language
            if (!foundChecker)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["LanguageName"].ToString() == languageDefault)
                    {
                        strSliderItem.Append("<li>");
                        strSliderItem.Append("<img src='" + dt.Rows[i]["Photo"].ToString() + "' ");
                        strSliderItem.Append("alt='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "' ");
                        strSliderItem.Append("title='" + (dt.Rows[i]["Name"] != DBNull.Value ? dt.Rows[i]["Name"].ToString() : "") + "'/>");
                        strSliderItem.Append("</li>");
                    }
                }
            }
            #endregion
            #region div Builder
            strOutput.Append("<div id='Slider' style='display:block;width:" + _width + ";height:" + _height + ";overflow:hidden;'>");
            strOutput.Append("<ul class='bjqs'>");
            strOutput.Append(strSliderItem.ToString());
            strOutput.Append("</ul>");
            strOutput.Append("</div>");
            #endregion
        }
        else
        {
            strOutput.Append("");
        }

        lblSlider.Text = strOutput.ToString();
    }
Ejemplo n.º 13
0
        private string GetMenuTextByID(string MsgID, string strMenuText)
        {
            string strTemp = "";
            clsLanguage objLang = new clsLanguage();
            strTemp = objLang.LanguageString(MsgID);
            objLang.Dispose();

            if(strTemp == "*****")
            {
                if( strMenuText.IndexOf("** ") == -1 )
                    strMenuText = "** " + strMenuText;
                return strMenuText;
            }
            else
                return strTemp;
        }
Ejemplo n.º 14
0
    /// <summary>
    /// ส่งเมล์จาก EmailTemplate โดยระบุค่าตัวแปรได้
    /// </summary>
    /// <param name="TemplateName">ชื่อ Template</param>
    /// <param name="From">เมล์ต้นทาง</param>
    /// <param name="To">เมล์ปลายทาง</param>
    /// <param name="Parameter">ค่าที่ใช้แทนในเมล์ เช่น [Username],nithi.re</param>
    /// <param name="outMessage">ข้อความแจ้งเตือนเมื่อเกิดข้อผิดพลาด</param>
    /// <param name="FromAliasName">ชื่อเมล์ต้นทาง</param>
    /// <param name="Cc">เมล์แนบ</param>
    /// <param name="Bcc">เมล์ไม่เปิดเผย</param>
    /// <param name="Signature">ข้อความท้ายเมล์</param>
    /// <returns>true=ส่งผ่าน , false=ส่งไม่ผ่าน</returns>
    /// <example>
    /// clsMail clsMail=new clsMail();
    /// string outMessage;
    /// clsMail.SendTemplate(
    ///     "UserRegisterConfirm",
    ///     "*****@*****.**",
    ///     "*****@*****.**",
    ///     new string[,] { { "[Username]", "ยูสเซอร์เนม" }, { "[UIDEncrypt]", "ยูไอดีเอ็นคริบ" } },
    ///     out outMessage);
    /// </example>
    public bool SendTemplate(string TemplateName, string From, string To, string[,] Parameter, out string outMessage, string FromAliasName = "", string Cc = "", string Bcc = "", string Signature = "")
    {
        #region Variable
        bool rtnValue = false;
        outMessage = "";

        StringBuilder strSQL      = new StringBuilder();
        DataTable     dt          = new DataTable();
        clsSQL        clsSQL      = new clsSQL();
        clsLanguage   clsLanguage = new clsLanguage();
        clsData       clsData     = new clsData();
        clsDefault    clsDefault  = new clsDefault();
        #endregion

        #region Found Language
        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("EmailTemplate.UID,Language.Name LanguageName,EmailTemplate.Subject,EmailTemplate.Message ");
        strSQL.Append("FROM ");
        strSQL.Append("EmailTemplate ");
        strSQL.Append("INNER JOIN Language ON EmailTemplate.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        //strSQL.Append("AND Language.Name='" + clsLanguage.LanguageCurrent + "' ");
        strSQL.Append("WHERE ");
        strSQL.Append("EmailTemplate.Active='1' ");
        strSQL.Append("AND EmailTemplate.Name='" + TemplateName + "' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC");
        #endregion

        dt            = clsSQL.Bind(strSQL.ToString(), dbType, cs);
        strSQL.Length = 0; strSQL.Capacity = 0;
        #endregion

        if (dt != null && dt.Rows.Count > 0)
        {
            #region Find LanguageRow
            bool languageMatch = false;
            int  i;

            for (i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    languageMatch = true;
                    break;
                }
            }
            if (!languageMatch)
            {
                i = 0;
            }
            #endregion

            #region Parameter Replace
            string subject = dt.Rows[i]["Subject"].ToString();
            string message = dt.Rows[i]["Message"].ToString();

            subject = clsData.Replacer(subject, Parameter);
            message = clsData.Replacer(message, Parameter);

            if (Send(From, To, subject, message, out outMessage, FromAliasName, Cc, Bcc, Signature))
            {
                SendTemplateLog(dt.Rows[i]["UID"].ToString(), From, To, Cc, Bcc, "Complete");
                rtnValue = true;
            }
            else
            {
                SendTemplateLog(dt.Rows[i]["UID"].ToString(), From, To, Cc, Bcc, clsDefault.Left(outMessage, 90));
                rtnValue = false;
            }
            #endregion
        }
        else
        {
            outMessage = "ไม่พบข้อมูล EmailTemplate";
            return(false);
        }

        return(rtnValue);
    }
Ejemplo n.º 15
0
        /// <summary>
        /// Retrieve messages for control
        /// </summary>
        /// <param name="objControl"></param>
        private void SetMessageForControl(System.Windows.Forms.Control objControl,string strMsgID)
        {
            clsLanguage objMessage;

            if(strMsgID.Trim() == "")
            {
                if(objControl.Text.Trim() != "")
                {
                    objControl.Text = "** " + objControl.Text;
                }
                return;
            }

            objMessage = new clsLanguage();

            string strTemp = objMessage.LanguageString(strMsgID);

            if (strTemp == "*****")
            {
                objControl.ForeColor = System.Drawing.Color.Orange;
                objControl.Text = "**" + objControl.Text;
            }
            else
            {
                objControl.Text = strTemp;
            }

            objMessage.Dispose();
            objMessage = null;
        }
Ejemplo n.º 16
0
        private void SetMessage4ComboItems(clsComboBox objCombo)
        {
            try
            {
                string[] local0 = new string[objCombo.Items.Count];

                for(int i=0; i < objCombo.Items.Count;i++)
                    local0[i] = objCombo.Items[i].ToString();

                objCombo.StoreItems(local0);

                objCombo.Items.Clear();

                for(int i=0; i < local0.Length; i++)
                {
                    clsLanguage objLang = new clsLanguage();
                    string m_strTemp = objLang.LangEngString(local0[i]);

                    if(m_strTemp != "*****")
                        objCombo.Items.Add(m_strTemp);
                    else
                        objCombo.Items.Add("** " + local0[i]);

                    objLang.Dispose();
                }
            }
            catch(Exception)
            {
                return;
            }
        }
Ejemplo n.º 17
0
    private void ContentBuilder()
    {
        #region Variable
        var strSQL    = new StringBuilder();
        var strScript = new StringBuilder();
        var dt        = new DataTable();
        var dtIndex   = 0;

        var clsSQL      = new clsSQL(clsGlobal.dbType, clsGlobal.cs);
        var clsSecurity = new clsSecurity();
        #endregion
        #region Procedure
        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("Content.UID,");
        strSQL.Append("Content.Name,");
        strSQL.Append("Content.Detail,");
        strSQL.Append("Content.Content,Content.ContentEN ");
        strSQL.Append("FROM ");
        strSQL.Append("P5_Content Content ");
        strSQL.Append("WHERE ");
        strSQL.Append("Content.StatusFlag='A' ");
        strSQL.Append("AND Content.Name='" + _contentName.Trim() + "';");
        #endregion
        dt = clsSQL.Bind(strSQL.ToString());
        if (dt != null && dt.Rows.Count > 0)
        {
            strScript.Append("<div class='" + (clsSecurity.LoginChecker("Admin") ? "dvContent" : "dvContentNormal") + "'>");
            #region Default Builder
            if (dt.Rows[0]["Content"] != DBNull.Value)
            {
                var clsLanguage = new clsLanguage();
                if (clsLanguage.LanguageCurrent == "th-TH")
                {
                    strScript.Append(dt.Rows[0]["Content"].ToString());
                }
                else
                {
                    strScript.Append((dt.Rows[0]["ContentEN"].ToString() != ""? dt.Rows[0]["ContentEN"].ToString(): dt.Rows[0]["Content"].ToString()));
                }
            }
            #endregion
            #region Admin Builder
            if (clsSecurity.LoginChecker("Admin"))
            {
                strScript.Append("<div class='dvContentMenu'>");
                strScript.Append("<a href='/Management/ContentManage.aspx?id=" + dt.Rows[dtIndex]["UID"].ToString() + "&command=edit' ");
                strScript.Append("title='แก้ไขข้อมูล' ");
                if (_modalRefreshOnClose)
                {
                    strScript.Append("class='cbIFrameRefreshOnClose'");
                }
                else
                {
                    strScript.Append("class='cbIFrame'");
                }
                strScript.Append(">");
                strScript.Append("<span class='Icon16 Edit' />");
                strScript.Append("</a>");
                strScript.Append("</div>");
            }
            #endregion
            strScript.Append("</div>");
            lblContent.Text = strScript.ToString();
        }
        #endregion
    }
    private void ContentBuilder()
    {
        #region Variable
        StringBuilder strSQL = new StringBuilder();
        StringBuilder strScript = new StringBuilder();
        DataTable dt = new DataTable();
        bool foundChecker = false;
        int dtIndex=0;

        clsSQL clsSQL = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();
        clsSecurity clsSecurity = new clsSecurity();
        #endregion

        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("Language.UID LanguageUID,");
        strSQL.Append("Language.Name LanguageName,");
        strSQL.Append("Content.UID,");
        strSQL.Append("Content.Name,");
        strSQL.Append("Content.Detail,");
        strSQL.Append("Content.Content ");
        strSQL.Append("FROM ");
        strSQL.Append("Content ");
        strSQL.Append("INNER JOIN Language ON Content.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("Content.Active='1' ");
        strSQL.Append("AND Content.Name='"+_contentName.Trim()+"' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC");
        #endregion

        dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);

        if (dt != null && dt.Rows.Count > 0)
        {
            strScript.Append("<div class='" + (clsSecurity.LoginChecker("Admin") ? "dvContent" : "dvContentNormal") + "'>");

            #region Find Language
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    foundChecker = true;
                    dtIndex=i;

                    #region Content Builder
                    if (dt.Rows[i]["Content"] != DBNull.Value)
                    {
                        strScript.Append(dt.Rows[i]["Content"].ToString());
                    }
                    #endregion

                    break;
                }
            }
            #endregion
            #region Default Builder
            if (!foundChecker)
            {
                if (dt.Rows[0]["Content"] != DBNull.Value)
                {
                    strScript.Append(dt.Rows[0]["Content"].ToString());
                }
            }
            #endregion
            #region Admin Builder
            if (clsSecurity.LoginChecker("Admin"))
            {
                strScript.Append("<div class='dvContentMenu'>");
                strScript.Append("<a href='/Management/ContentManage.aspx?id="+dt.Rows[dtIndex]["UID"].ToString()+"&command=edit' ");
                strScript.Append("title='แก้ไขข้อมูล' ");
                if (_modalRefreshOnClose)
                {
                    strScript.Append("class='cbIFrameRefreshOnClose'");
                }
                else
                {
                    strScript.Append("class='cbIFrame'");
                }
                strScript.Append(">");
                strScript.Append("<span class='Icon16 Edit' />");
                strScript.Append("</a>");
                strScript.Append("</div>");
            }
            #endregion

            strScript.Append("</div>");
            lblContent.Text = strScript.ToString();
        }
    }
Ejemplo n.º 19
0
    private void ContentBuilder()
    {
        #region Variable
        StringBuilder strSQL       = new StringBuilder();
        StringBuilder strScript    = new StringBuilder();
        DataTable     dt           = new DataTable();
        bool          foundChecker = false;
        int           dtIndex      = 0;

        clsSQL      clsSQL      = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();
        clsSecurity clsSecurity = new clsSecurity();
        #endregion

        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("Language.UID LanguageUID,");
        strSQL.Append("Language.Name LanguageName,");
        strSQL.Append("Content.UID,");
        strSQL.Append("Content.Name,");
        strSQL.Append("Content.Detail,");
        strSQL.Append("Content.Content ");
        strSQL.Append("FROM ");
        strSQL.Append("Content ");
        strSQL.Append("INNER JOIN Language ON Content.LanguageUID=Language.UID ");
        strSQL.Append("AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("Content.Active='1' ");
        strSQL.Append("AND Content.Name='" + _contentName.Trim() + "' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("Language.Sort ASC");
        #endregion

        dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);

        if (dt != null && dt.Rows.Count > 0)
        {
            strScript.Append("<div class='" + (clsSecurity.LoginChecker("Admin") ? "dvContent" : "dvContentNormal") + "'>");

            #region Find Language
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent)
                {
                    foundChecker = true;
                    dtIndex      = i;

                    #region Content Builder
                    if (dt.Rows[i]["Content"] != DBNull.Value)
                    {
                        strScript.Append(dt.Rows[i]["Content"].ToString());
                    }
                    #endregion

                    break;
                }
            }
            #endregion
            #region Default Builder
            if (!foundChecker)
            {
                if (dt.Rows[0]["Content"] != DBNull.Value)
                {
                    strScript.Append(dt.Rows[0]["Content"].ToString());
                }
            }
            #endregion
            #region Admin Builder
            if (clsSecurity.LoginChecker("Admin"))
            {
                strScript.Append("<div class='dvContentMenu'>");
                strScript.Append("<a href='/Management/ContentManage.aspx?id=" + dt.Rows[dtIndex]["UID"].ToString() + "&command=edit' ");
                strScript.Append("title='แก้ไขข้อมูล' ");
                if (_modalRefreshOnClose)
                {
                    strScript.Append("class='cbIFrameRefreshOnClose'");
                }
                else
                {
                    strScript.Append("class='cbIFrame'");
                }
                strScript.Append(">");
                strScript.Append("<span class='Icon16 Edit' />");
                strScript.Append("</a>");
                strScript.Append("</div>");
            }
            #endregion

            strScript.Append("</div>");
            lblContent.Text = strScript.ToString();
        }
    }
Ejemplo n.º 20
0
 private string GetStringOnID(string strID)
 {
     clsLanguage objMessage = new clsLanguage();
     string strTemp = objMessage.LanguageString(strID);
     objMessage.Dispose();
     objMessage = null;
     if (strTemp == "*****")
         return "** " + this.Text ;
     else
         return strTemp;
 }
    private string CenterBuilder()
    {
        #region Variable
        clsDefault clsDefault = new clsDefault();
        clsSQL clsSQL = new clsSQL();
        clsLanguage clsLanguage = new clsLanguage();

        StringBuilder strSQL = new StringBuilder();
        StringBuilder strCenter = new StringBuilder();
        DataTable dtGroup = new DataTable();
        DataTable dt = new DataTable();
        #endregion
        #region MedicalCenterGroup : SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("MedicalCenterGroup.UID,");
        strSQL.Append("MedicalCenterGroup.Name ");
        strSQL.Append("FROM ");
        strSQL.Append("MedicalCenterGroup ");
        strSQL.Append("INNER JOIN Language ON MedicalCenterGroup.LanguageUID=Language.UID AND Language.Active='1' ");
        strSQL.Append("WHERE ");
        strSQL.Append("MedicalCenterGroup.Active='1' ");
        strSQL.Append("AND Language.Name='" + clsLanguage.LanguageCurrent + "' ");
        strSQL.Append("ORDER BY ");
        strSQL.Append("MedicalCenterGroup.Sort");
        #endregion

        dtGroup = clsSQL.Bind(strSQL.ToString(), dbType, cs);
        strSQL.Length = 0; strSQL.Capacity = 0;

        strCenter.Append("<div style='padding:0 10px 0 10px;width:400px;'>");
        if (dtGroup != null && dtGroup.Rows.Count > 0)
        {
            for (int i = 0; i < dtGroup.Rows.Count; i++)
            {
                strCenter.Append("<h4>" + dtGroup.Rows[i]["Name"].ToString() + "</h4>");

                #region MedicalCenter
                #region MedicalCenter : SQL Query
                strSQL.Append("SELECT ");
                //strSQL.Append("UID,");
                strSQL.Append("DepartmentUID UID,");
                strSQL.Append("Name ");
                strSQL.Append("FROM ");
                strSQL.Append("MedicalCenter ");
                strSQL.Append("WHERE ");
                strSQL.Append("MedicalCenterGroupUID=" + dtGroup.Rows[i]["UID"].ToString() + " ");
                strSQL.Append("AND Active='1' ");
                #endregion

                dt = clsSQL.Bind(strSQL.ToString(), dbType, cs);
                strSQL.Length = 0; strSQL.Capacity = 0;

                if (dt != null && dt.Rows.Count > 0)
                {
                    strCenter.Append("<table cellpadding='0' cellspacing='0'>");
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        if ((j+1) % 2 != 0)
                        {
                            strCenter.Append("<tr>");
                            strCenter.Append("<td style='width:200px;'>");
                            strCenter.Append("<a href='/MedicalCenter/" + dt.Rows[j]["UID"].ToString() + "/" + clsDefault.URLRoutingFilter(dt.Rows[j]["Name"]) + "/'>");
                            strCenter.Append(dt.Rows[j]["Name"].ToString());
                            strCenter.Append("</a>");
                            strCenter.Append("</td>");
                        }
                        else
                        {
                            strCenter.Append("<td style='width:200px;'>");
                            strCenter.Append("<a href='/MedicalCenter/" + dt.Rows[j]["UID"].ToString() + "/" + clsDefault.URLRoutingFilter(dt.Rows[j]["Name"]) + "/'>");
                            strCenter.Append(dt.Rows[j]["Name"].ToString());
                            strCenter.Append("</a>");
                            strCenter.Append("</td>");
                            strCenter.Append("</tr>");
                        }
                    }
                    if (dt.Rows.Count % 2 != 0)
                    {
                        strCenter.Append("<td style='width:200px;'>");
                        strCenter.Append("</td>");
                        strCenter.Append("</tr>");
                    }
                    strCenter.Append("</table>");

                    dt = null;
                }
                else
                {
                    strCenter.Append("<div style='text-align:center;'>-</div>");
                }
                #endregion
            }
        }
        else
        {
            strCenter.Append("-");
        }
        strCenter.Append("</div>");

        /*
        
        
        strCenter.Append("<tr>");
        strCenter.Append("<td style='width:200px;'>");
        strCenter.Append("<a href='/Center/" + dt.Rows[i]["MedicalCenterUID"].ToString() + "/" + dt.Rows[i]["MedicalCenterName"].ToString() + "/'>");
        strCenter.Append(dt.Rows[i]["MedicalCenterName"].ToString());
        strCenter.Append("</a>");
        strCenter.Append("</td>");
        strCenter.Append("<td style='width:200px;'>");
        strCenter.Append("<a href='/Center/" + dt.Rows[i]["MedicalCenterUID"].ToString() + "/" + dt.Rows[i]["MedicalCenterName"].ToString() + "/'>");
        strCenter.Append(dt.Rows[i]["MedicalCenterName"].ToString());
        strCenter.Append("</a>");
        strCenter.Append("</td>");
        strCenter.Append("</tr>");
        
        
        */
        return strCenter.ToString();
    }
Ejemplo n.º 22
0
        private void SetMessageForLabel(clsLabel _label, string strMsgID)
        {
            clsLanguage objMessage;

            if (strMsgID.StartsWith("$"))
            {
                _label.Text = strMsgID.Substring(1, strMsgID.Length - 1).ToString();
                return;
            }
            if (strMsgID.Trim() == "")
            {
                if (_label.Text.Trim() != "")
                {
                    _label.Text = "** " + _label.Text;
                }
                return;
            }

            objMessage = new clsLanguage();

            string strTemp = objMessage.LanguageString(strMsgID);

            if (strTemp == "*****")
            {
                _label.ForeColor = System.Drawing.Color.Orange;
                _label.Text = "**" + _label.Text;
            }
            else
            {
                _label.Text = strTemp;
            }

            objMessage.Dispose();
            objMessage = null;
        }