Tuesday, December 31, 2019

Datatable to excel Download

public static void ExcelPrintWithSubReport(string SpName, DataTable dataSource)
        {

            GridView gv = new GridView();
            gv.DataSource = dataSource;
            gv.DataBind();

            SpName = SpName + ".xls";

            HttpContext context = System.Web.HttpContext.Current;
            context.Response.ClearContent();
            context.Response.Buffer = true;
            context.Response.AddHeader("content-disposition", "attachment; filename= CheckData.xls");
            context.Response.ContentType = "application/ms-excel";
            context.Response.Charset = "";
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            gv.RenderControl(htw);
            context.Response.Output.Write(sw.ToString());
            context.Response.Flush();
            htw.Close();
            sw.Close();
            context.Response.End();

        }// End of Method

Delete Data From Joining Tables

Delete ev   FROM Evaluation AS ev
Inner Join Employee AS e ON ev.EmployeeId = e.EmployeeId
 WHERE
 e.OfficeId IN ( SELECT OfficeId FROM Office WHERE ThirdLevel = 2790 AND IsActive = 1 )
 AND ev.Year = 2019
 AND ev.EvaluationPeriodShort = 'D'

Sunday, November 10, 2019

SMS Count Function

--SELECT SUBSTRING('SQL Tutorial', 1, 100) AS ExtractString;   
   
-- SELECT dbo.CountSMS('HELLOJINIENENENENEE E E E E E  E EJENJDNEJDNE E EJDNENEF E EJNEF HELLOJINIENENENENEE E E E E E  E EJENJDNEJDNE E EJDNENEF E EJNEF HELLOJINIENENENENEE E E E E E  E EJENJDNEJDNE E EJDNENEF E EJNEF')   
CREATE FUNCTION CountSMS(@StringName nvarchar(1000))   
RETURNS int   
AS   
BEGIN   
--Declare @StringName nvarchar(50);   
Declare @initialLen int;   
Declare @WithFraction decimal(18,2);   
Declare @WithoutFraction int; 
Declare @smsCount int;   
   
SET @WithFraction = 0.00;   
SET @smsCount = 1;   
   
SET @initialLen = (SELECT len(@StringName));   
   
SET @WithFraction = @initialLen / 70.00;   
SET @WithoutFraction = @WithFraction 
   
IF(@WithFraction > @WithoutFraction)   --(@WithFraction < 1.00 AND @WithFraction > 0.00)   
BEGIN   
SET @smsCount = @WithoutFraction + 1;   
END   
ELSE   
BEGIN   
SET @smsCount = ROUND(@WithFraction,0);   
END   
   
   
   RETURN @smsCount   
   
 END   
   
-- SELECT SUBSTRING('SQL Tutorial', 1,1) AS ExtractString;

Monday, November 4, 2019

SQL FUNCTION Convert Numeric value to bangla.

--SELECT SUBSTRING('SQL Tutorial', 1, 100) AS ExtractString;

-- SELECT dbo.ConvertToBangla(12456.9087)
ALTER FUNCTION ConvertToBangla(@StringName nvarchar(50))
RETURNS NVARCHAR(50)
AS
BEGIN

--Declare @StringName nvarchar(50);
Declare @FinalString nvarchar(50);
Declare @FinalString2 nvarchar(50);

Declare @SingleCharacter nvarchar(1);
Declare @len int;
Declare @Templen int;

--SET @StringName = '8767564.89780';
SET @FinalString = N'';
SET @len = (SELECT LEN(@StringName));
SET @Templen = 1;
--SELECT @len

 WHILE @Templen <= @len
BEGIN
  SELECT @SingleCharacter = SUBSTRING(@StringName, @Templen,1)
 
    --SELECT  @SingleCharacter;
 
   SELECT @FinalString2 =
   CASE
    WHEN @SingleCharacter = '1' THEN N'১'
    WHEN @SingleCharacter = '2' THEN N'২'
    WHEN @SingleCharacter = '3' THEN N'৩'
WHEN @SingleCharacter = '4' THEN N'৪'
WHEN @SingleCharacter = '5' THEN N'৫'
WHEN @SingleCharacter = '6' THEN N'৬'
WHEN @SingleCharacter = '7' THEN N'৭'
WHEN @SingleCharacter = '8' THEN N'৮'
WHEN @SingleCharacter = '9' THEN N'৯'
WHEN @SingleCharacter = '0' THEN N'০'
WHEN @SingleCharacter = '.' THEN N'.'
    ELSE N''
END
--SELECT @FinalString2;

SET @FinalString = @FinalString + @FinalString2

SET @Templen = @Templen + 1;

END;

   --SELECT @FinalString;
   RETURN @FinalString
 
 END

-- SELECT SUBSTRING('SQL Tutorial', 1,1) AS ExtractString;

Sunday, October 20, 2019

Export Table to other Server: SQL SERVER


STEP 1: Right Click on Source database. Here you will see some Options. 

  Click on Export data.

STEP 2: A wizard will open. click on next button.


STEP 3:  Here the Source Of data need to choose. Give the credentials and select the database.


STEP 4: Continued of step 3. Choose the Source database.



STEP 5: In this step you have to choose the destination database. Give the credentials and select the database.


STEP 6: In this step the table need to choose. From which the data will be transfer. Notice the right side is the table name which will be on the destination server.




STEP 7: Keep Click on next.



STEP 8: Here the process will be started.


STEP 9: After the process is done this screen will be showed. click on close.


Now go to the destination database server. Execute: Select * FROM theTableName

Wednesday, October 2, 2019

My Work::KHALID

: Xamarin App Development
: R&D on new technologies
: File Management Systems
: gHRM New Features ; Rich text box, New Reports , Process on sql server side.
: gBanker : R&D: Add rich text Box, Using Ajax: On Select Member Show Photo and Signature.
: SMS: gHRM and gBanker New Module.
: Voice Data collection : Hisab.
: gHRM plus Attendence system and Time Picker add.
: digital signature add. Canvas to Crystal report.

Monday, September 30, 2019

Show image using ajax call



I created a service to get member information using entity framework.

then i used the service like this.

 [HttpGet]
        public JsonResult GetMemberImageData(string MemberId)
        {
            try
            {
  var memberPhoto = memberService.GetById(Convert.ToInt32(MemberId));

MemberViewModel myMember = new MemberViewModel();
myMember.MemberCode = Convert.ToBase64String( memberPhoto.MemberImg );

 List<MemberViewModel> List_ViewModel = new List<MemberViewModel>();

                List_ViewModel.Add(myMember);


  return Json(List_ViewModel.ToList(), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            { return Json(ex.ToString(), JsonRequestBehavior.AllowGet); }

        }



in view:  .cshtml file::
function GetMemberPhotoSignature(member)
    {
        //alert(member);

         $.ajax({
            type: 'GET',
            contentType: "application/json; charset=utf-8",
            url: '@Url.Action("GetMemberImageData", "SpecialSavingCollection", "http")',
             data: { MemberId: member },
            dataType: 'json',
            async: true,
            success: function (data) {
                $('#AjaxLoader').hide();
                $.each(data, function (index, data) {
                    if (data != "Error") {
                        alert(data.MemberCode);
                        $("#target").attr("src", "data:image/gif;base64, " + data.MemberCode);
                            //$("#EmployeeID").val(data.EmployeeID);
                    }
                    else {
                       
                       // $("#EmployeeName").val('');
                    }
                });
            },
            error: function (request, status, error) {
                $('#AjaxLoader').hide();
             
               // $.alert.open("Employee Does Not Exist");
            }
        });




HTML::
<img id="target" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
 AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />






Monday, August 26, 2019

Debug on physical Device. Android Xamarin

I tried and tried. Keep searching.. Tried many ways... But there is always a perfect solution...Need to find that.



I did every thing. setup my android phone on

1.developer mode.

2. enable usb debugger.



etc.



But there was a problem on my laptop. The adb interface( Control panel-> device manager-> other devices-> adb interface) was not correctly installed(yellow marking).



Then I searched for it found https://adb.clockworkmod.com/ .

Download and install. But for perfection you can uninstall the previous adb interface.








Friday, July 19, 2019

There were deployment errors : XAMARIN


This error occurs for mis-configuration of Application.
Make sure you have configured sdk correctly. Tools-> Option-> Xamarin (Give the right path of jdk)


Right click on your project. -> properties -> Android Options-> check Use share Runtime. Uncheck Use Fast Deployment(debug mode only).


Right click on your project. -> properties -> Application-> set the right version of Android sdk and your emulators Android sdk  from dropdown


It should solve your errors.

Tuesday, July 16, 2019

MOTHER

M is for the million things she gave me.
O means only that she's growing Old.
T is for the tears she shed to save me
H is for her heart of purest gold.
E is for her eyes, with love-light shining.
R means right, and right she'll always be.

Together, they spell "MOTHER"
That means the world to us.

gHRM GC Work BarCode Generator and Bulk data Upload

Barcode Generator using ZXing.Net.      ZXing library

Upload data of attendance csv file format.

Tuesday, June 18, 2019

Pass Parameter to javascript function

return '<div class="text-center"><a href="#" OnClick="Open(\''+ data.record.FileName + '\');"><i class="fa fa-trash-o"></i></a></div>';



Monday, June 10, 2019

Multiple Account Code Correction


Search and Update Account Code (Distribute From One Account to Other Account Or Create New.)

Bulk SMS Send

This is a Bulk sms send UI. Users Can create Group, Create
Custom SMS, Create a Effective date
(Send automatic sms by process, services).

.Net Framework
C# Language
Rest API





public JsonResult ExecuteMessage(string SendTo, string SENDMessageDetailsId)
        {
            HttpClient Client = new HttpClient();
            Client.BaseAddress = new Uri("http://192.192.192.233:8091/"); //api/nonmaskingsms/easysend?sender=01713140127&message=hello%20bangladesh)
            Client.DefaultRequestHeaders.Clear();
            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            //Client.DefaultRequestHeaders.Add("Accept", "application/json");
            //Client.DefaultRequestHeaders.Add("Content-Type", "application/json");
            HttpResponseMessage message = Client.GetAsync($"api/......../(nonmaskingsms/easysend)?sender={SendTo}&message={SENDMessageDetailsId}").Result;
            if (message.IsSuccessStatusCode)
            {
                return Json(1, JsonRequestBehavior.AllowGet);
            }
            else
                return Json(0, JsonRequestBehavior.AllowGet);
        }

Tuesday, April 30, 2019

Second most Highest Salary SQl server

Find Second most Highest salary.

Emp Name  | Salary
a                 | 200000
b                |  50000
c               | 90000
d                 | 100000

Select name, max(Salary) as salary from employee WHERE salary < (Select Max(Salary) From Employee)

Find Third Higher Salary:

Select name, max(Salary) as salary from employee
WHERE salary <
(
Select max(Salary) as salary from employee WHERE salary < (Select Max(Salary) From Employee)
)

By DENSE Rank:
WITH T AS
(
     SELECT * FROM DENSE_RANK() OVER (ORDER BY Salary Desc) AS rank
From Employees
)
SELECT Name
FROM T
WHERE
rank = 2

By Top 1:

Select name, Salary FROM Employee
WHERE Salary < (Select Top 1 Salary From employee Order By Salary Desc)

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.