Thursday, June 30, 2016

Surah Al-Baqarah

"O mankind, worship your Lord, who created you and those before you, that you may become righteous"
Surah Al-Baqarah [2:21]




"[He] who made for you the earth a bed [spread out] and the sky a ceiling and sent down from the sky, rain and brought forth thereby fruits as provision for you. So do not attribute to Allah equals while you know [that there is nothing similar to Him]"
Surah Al-Baqarah [2:22]





"How can you disbelieve in Allah when you were lifeless and He brought you to life; then He will cause you to die, then He will bring you [back] to life, and then to Him you will be returned"
Surah Al-Baqarah [2:28]



"And do not mix the truth with falsehood or conceal the truth while you know [it]"
Surah Al-Baqarah [2:42]



"And establish prayer and give zakah and bow with those who bow [in worship and obedience]"
Surah Al-Baqarah [2:43]



"O Children of Israel, remember My favor that I have bestowed upon you and that I preferred you over the worlds"
Surah Al-Baqarah [2:47]





"And fear a Day when no soul will suffice(চলা) for another soul at all, nor will intercession(মধ্যস্থতা) be accepted from it, nor will compensation(ক্ষতিপূরণ) be taken from it, nor will they be aided(সাহায্য)"
Surah Al-Baqarah [2:48]




Visit my youtube channel.

Monday, June 27, 2016

Total Sum by Angular JS

In the index.cshtml file: 

 <tr>
                        <td></td>
                        <td ><b>Total:</b> </td>
                        <td><p id="gridTotalamount">{{GetSummOfAmount(PConsultData)}}</p></td>
                        <td></td>
 </tr>

In the Js File(PatientConsult.js):

 $scope.GetSummOfAmount = function (PConsultData) {
        var summ = 0;
     
        for (var i in PConsultData) {
            summ = summ + Number(PConsultData[i].Amount);
        } 
   


        return summ;

    };



See how palindrome works.


Saturday, June 25, 2016

Required sign in the Labels

 <div class="col-md-2">
                            <label>Doctor Name<span class="required" style="color:red">*</span></label>
  </div>

Meta Tag in HTML

Example:
<head>
<meta charset="UTF-8">
<meta name="description" content="Web Technology">
<meta name="keywords" content="HTML,CSS,XML,JavaScript,ASP.NET,MVC">
<meta name="author" content="SS Technology">
</head>


Meta is data(information) about data. The <meta> tag provides metadata about the HTML document. Meta data will not be displayed on the web page. 
Meta elements are typically used to specify page description, keyword, author of the document, last modified and other meta data.  


Array Input output by C Programming

Tuesday, June 14, 2016

Converting Date Format and Time

 var for_formatting = (from n in db.BillMasterDbSet where n.COMPID == compid && n.PATIENTYY == year && n.PATIENTYYID == yearID select n).ToList(); //fetch data

                    string billdt= "", discharge = "", disTime = "";
                    foreach(var x in for_formatting)
                    {
                        billdt = Convert.ToDateTime(x.BILLDT).ToString("dd-MMM-yyyy");
// Example: Jun-14-2016
                        discharge = Convert.ToDateTime(x.DISCHGDT).ToString("dd-MMM-yyyy");
                        disTime = Convert.ToDateTime(x.DISCHGTM).ToString("HH:mm:ss");

                    }

Saturday, June 11, 2016

Autocomplete in Asp.NET MVC using Webapi 2

In the following part I am showing javascript Code:

 $('#PATIENTYYID').autocomplete({
                source: function (request, response) {
                    var compid = $('#txtcompid').val();
                    var year = $('#PATIENTYY').val();
                    $.ajax({
                        url: '/api/ApiControllername/PatientYID',
                        type: 'GET',
                        cache: false,
                        data: { query: request.term, query2: compid, Year: year },
                        dataType: 'json',
                        success: function (data) {
                            response($.map(data, function (item) {
                                return {
                                    label: item,
                                    value: item,


                                };
                            }));
                        }
                    });
                },
                select: function (event, ui) {
                    $('#PATIENTYYID').val(ui.item.label);


                    txtOneChanged();

                },
                change: $('#PATIENTYYID').keyup(_.debounce(txtOneChanged, 500))
            });


    function txtOneChanged() {


            var changedText = $("#PATIENTYYID").val();
            var changedText2 = $('#txtcompid').val();
            var year = $('#PATIENTYY').val();

            //var Name = document.getElementById('PatientYearID');
            var txtBox = document.getElementById('PATIENTYYID');

            var txtBox2 = document.getElementById('PatientName');

            var txtBox3 = document.getElementById('BILLDT');
            var txtBox4 = document.getElementById('BILLNO');
            var txtBox5 = document.getElementById('BILLYY');
            var txtBox6 = document.getElementById('DISCHGDT');
            var txtBox7 = document.getElementById('DISCHGTM');
            var txtBox8 = document.getElementById('RemarksMaster');

            if (changedText != "") {
                $.getJSON(
                 '/api/PatientName', { "ChangedText": changedText, "ChangedText2": changedText2 },//apiCabinBed
                 function (result) {

                     txtBox2.value = result;






                 });

                $.getJSON(
                    '/api/ApiControllername/DynamicPatinetYearId', {
                        "ChangedText": changedText, "ChangedText2": changedText2, "Year": year
                    },
                    function (result) {

                        txtBox.value = result[0].PATIENTYYID;
                        txtBox3.value = result[0].BILLDT;
                        txtBox4.value = result[0].BILLNO;
                        txtBox5.value = result[0].BILLYY;
                        txtBox6.value = result[0].DISCHGDT;
                        txtBox7.value = result[0].DISCHGTM;
                        txtBox8.value = result[0].RemarksMaster;





                    });

            }



        }


Lower Part Script:
<link href="~/Content/themes/base/jquery-ui.css" rel="stylesheet" />

<script src="~/Scripts/jquery-ui-1.10.4.min.js"></script>

Now I am showing What I have done in the Apicontroller: 

  [System.Web.Http.Route("api/apiControllername/PatientYID")]
        [System.Web.Http.HttpGet]
        public IEnumerable<string> GetPatinetYearID(string query, string query2, Int64 Year)
        {
            using (var db = new DbContext())
            {
                Int64 compid = Convert.ToInt64(query2);
                List<string> result = new List<string>();
                var tags = from p in db.HDBContext
                           where p.COMPID == compid
                           select new { p.PATIENTYYID };
                string date = Convert.ToString(Year);

                string currentyear = date.Substring(2, 2);
                foreach (var tag in tags)
                {
                    if ((tag.PATIENTYYID.ToString().StartsWith(query) == true) && (tag.PATIENTYYID.ToString().StartsWith(currentyear) == true))
                    {
                        result.Add(tag.PATIENTYYID.ToString());
                    }

                }
                IEnumerable<string> en = result;


                return en;



            }
        }


        [System.Web.Http.Route("api/apiControllername/DynamicPatinetYearId")]
        [System.Web.Http.HttpGet]
        public IEnumerable<BDTO> DynamicPatientYid(string changedText, string changedText2, Int64 year)
        {
            using (var db = new DbContext())
            {
                Int64 compid = Convert.ToInt64(changedText2);
           
                String name = "";



                List<string> rt = new List<string>();

                var tags = from p in db.HDBContext
                           where p.COMPID == compid
                           select new { p.PATIENTYYID };
                string date = Convert.ToString(year);

                string currentyear = date.Substring(2, 2);
                //string currentyear = Convert.ToString(td).Substring(8, 2);
                foreach (var tag in tags)
                {
                    if ((tag.PATIENTYYID.ToString().StartsWith(changedText) == true) && (tag.PATIENTYYID.ToString().StartsWith(currentyear) == true))
                    {
                        rt.Add(tag.PATIENTYYID.ToString());
                    }

                }




                int lenChangedtxt = changedText.Length;

                Int64 cont = rt.Count();
                Int64 k = 0;
                string status = "";
                if (changedText != "" && cont != 0)
                {
                    while (status != "no")
                    {
                        k = 0;
                        foreach (var n in rt)
                        {
                            string ss = Convert.ToString(n);
                            string subss = "";
                            if (ss.Length >= lenChangedtxt)
                            {
                                subss = ss.Substring(0, lenChangedtxt);
                                subss = subss.ToUpper();
                            }
                            else
                            {
                                subss = "";
                            }


                            if (subss == changedText.ToUpper())
                            {
                                k++;
                            }
                            if (k == cont)
                            {
                                status = "yes";
                                lenChangedtxt++;
                                if (ss.Length > lenChangedtxt - 1)
                                {
                                    changedText = changedText + ss[lenChangedtxt - 1];
                                }
                                k = 0;
                            }
                            else
                            {
                                status = "no";
                                //lenChangedtxt--;

                            }

                        }

                    }
                    if (lenChangedtxt == 1)
                    {
                        name = changedText.Substring(0, lenChangedtxt);
                    }

                    else if (lenChangedtxt > 1)
                    {
                        name = changedText.Substring(0, lenChangedtxt - 1);
                    }




                }
                else
                {
                    name = changedText;
                }

                   Int64 yearID = Convert.ToInt64(name);

                   var find_data = (from n in db.BillMasterDbSet where n.COMPID == compid && n.PATIENTYY == year && n.PATIENTYYID==yearID select n).ToList();
                if(find_data.Count!=0)
                {
                    return (from t1 in db.BillMasterDbSet

                            where t1.COMPID == compid && t1.PATIENTYY == year && t1.PATIENTYYID == yearID
                            select new
                            {
                                billdate = t1.BILLDT,
                                billno = t1.BILLNO,
                                billyear = t1.BILLYY,
                                dischargedate = t1.DISCHGDT,
                                dischargetime = t1.DISCHGTM,
                                remarks=t1.REMARKS


                            })
                   .AsEnumerable().Select(a => new BillMasterDTO
                   {
                       PATIENTYYID=yearID,
                      BILLDT=Convert.ToString(a.billdate),
                      BILLYY=a.billyear,
                      BILLNO=a.billno,
                      DISCHGDT=a.dischargedate,
                      DISCHGTM=a.dischargetime,
                      RemarksMaster=a.remarks


                   }).ToList();
                }
                else
                {
                    return db.HMS_IpdDbSet.AsEnumerable().Select(a => new BillMasterDTO
                    {
                        PATIENTYYID = yearID,
                        PatientName = "",
                        BILLDT = "",
                        BILLYY = 0,
                        BILLNO = 0,
                     
                        RemarksMaster = ""


                    }).ToList();
                }

            }

        }

My autocomplete is slightly changed from general autocomplete. I am using an algorithm for matching 1st common part and showing that.
Example: Data set like: 1600001, 1600002, 1600003
By my autocomplete if you press 1 then it shows all related data and fetch 160000 to that textbox. Because 160000 is common in those data set.


Thank you
Enjoy Coding
SS Team

Thursday, June 9, 2016

4 mistakes to avoid in Ramadan

4 mistakes to avoid in Ramadan

1. getting angry
2. sleeping all day
3. fasting without prayer
4. and using bad languages


O ye who believe! Fasting is prescribed to you as it was prescribed to those before you, that ye may (learn) self-restraint. [2:183]

Monday, June 6, 2016

Update by SQL

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;