コード例 #1
0
        protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            //txtCompanyAddress.Text = db.getDbstatus_Value("select Company_Address from tblCompanyPlacementMaster where OrgId='" + orgId.ToString() + "' and Company_Name='" + ddlcompanyName.Text + "'");
            DataTable ddt = db.DbCon("Select * from  tblCompanyPlacementMaster where OrgId='" + orgId.ToString() + "' and Company_Name='" + ddlcompanyName.Text + "'");

            txtCompanyAddress.Text = ddt.Rows[0]["Company_Address"].ToString();
            txtWebsite.Text        = ddt.Rows[0]["Website"].ToString();
            txtCompanyEmail.Text   = ddt.Rows[0]["Company_email"].ToString();
            txtCompanyMobile.Text  = ddt.Rows[0]["Company_mob"].ToString();
            txtContactPerson.Text  = ddt.Rows[0]["Contact_Person"].ToString();
            txtCriteria.Text       = ddt.Rows[0]["Criteria"].ToString();
        }
コード例 #2
0
        ////for mail
        //#region SendeMailRegion

        //private string SendEmails()
        //{
        //    string stringResult = null;
        //    //string mailFrom = Convert.ToString("*****@*****.**");   //your own correct Gmail Address
        //    //string password = Convert.ToString("logicpro@2017");

        //   string mailFrom = WebConfigurationManager.AppSettings["mail"];
        //   string password = WebConfigurationManager.AppSettings["password"];
        //    //string mailTo = Convert.ToString("*****@*****.**");       //Email Address to whom you want to send the mail


        //    string mailTo = Convert.ToString(txtEmail.Text);

        //    System.Net.Mail.MailMessage email = new System.Net.Mail.MailMessage();
        //    email.To.Add(new System.Net.Mail.MailAddress(mailTo));
        //    email.From = new System.Net.Mail.MailAddress(mailFrom, "LogicPro Solutions College ERP", System.Text.Encoding.UTF8);

        //    email.Subject = "Staff Registration";
        //    email.SubjectEncoding = System.Text.Encoding.UTF8;
        //    email.Body = "Dear" + txtFirstName.Text + " " + txtLastName.Text + "  Your Registration is Successfully .  \n\n  Please Note Down Your Login Details  \n\n   UserName :"******"\n \n   Password:"******"\n\n Thank You For Registration !!:";// "Thanks for visiting our Hotel...Come again And Enjoy Your Service : \n\n    Your Total Reward Points Are :" + txtTotalReward.Text + " \n\n Thanks And Regards,\n\n " + companyNm+ "";

        //    //email.Body = "Dear " + txtFirstName.Text + "  " + txtLastName.Text + " Your Registration Submitted Successfully .  Please Note Down Your Login Details UserName : "******" Password : "******" Thank You For Registraion !!";
        //    email.BodyEncoding = System.Text.Encoding.UTF8;
        //    email.Priority = System.Net.Mail.MailPriority.High;

        //    System.Net.Mail.SmtpClient Smtp = new System.Net.Mail.SmtpClient();
        //    Smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        //    Smtp.Credentials = new System.Net.NetworkCredential(mailFrom, password);//Add the Creddentials- use your own email id and password
        //    Smtp.Port = 587;   // Gmail works on this port
        //    Smtp.Host = "smtp.gmail.com";
        //    Smtp.EnableSsl = true;     //Gmail works on Server Secured Layer
        //    try
        //    {
        //        Smtp.Send(email);
        //        stringResult = "Email has been sent successfully...";
        //    }
        //    catch (Exception ex)
        //    {
        //        stringResult = ex.Message;
        //    }
        //    finally
        //    {
        //        Server.Transfer("Admin_Home.aspx");
        //    }
        //    return stringResult;
        //}

        //#endregion



        //Calculate Balance

        //public void CalculateBalance()
        //{
        //    DataView dvBalance = new DataView(ViewState["LeaveBalance"] as DataTable);

        //    DataView dvLeaveDetails = new DataView(ViewState["tempLeaveDetails"] as DataTable);
        //}


        //Perform Action for Leave Application
        #region [Perform Action]

        private void Action(string strAction)
        {
            try
            {
                count = 0;
                foreach (GridViewRow gvrow in GrdLeaveDetails.Rows)
                {
                    CheckBox chk = (CheckBox)gvrow.FindControl("chkbox");
                    if (chk != null && chk.Checked)
                    {
                        int id = Convert.ToInt32(GrdLeaveDetails.DataKeys[gvrow.RowIndex].Values["Id"].ToString());


                        SqlCommand cmd = new SqlCommand("SP_LeaveApplication", cn);
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@Action", "LeaveSanctioned");
                        cmd.Parameters.AddWithValue("@ApplicationID", id);
                        cmd.Parameters.AddWithValue("@OrgId", Convert.ToInt32(Session["OrgId"]));
                        cmd.Parameters.AddWithValue("@HRNote", txtReason.Text);
                        cmd.Parameters.AddWithValue("@LeaveStatus", ddlStatus.SelectedValue);
                        cn.Open();
                        int flag = cmd.ExecuteNonQuery();
                        cn.Close();


                        //db.insert("update tblLeaveApplication set LeaveStatus='" + ddlStatus.SelectedValue.ToString() + "',HRNote='"+ txtReason.Text.Trim() + "' where ApplicationId='" + id + "'");
                        //objEWA.Action = strAction;

                        count++;

                        //string ucode = GrdLeaveDetails.DataKeys[gvrow.RowIndex].Values["User Code"].ToString();
                        //string Fromdate = GrdLeaveDetails.DataKeys[gvrow.RowIndex].Values["From Date"].ToString();
                        //string Todate = GrdLeaveDetails.DataKeys[gvrow.RowIndex].Values["To Date"].ToString();
                        //objEWA.UserCode = ucode.ToString();
                        //objEWA.ApplicationDate = lblApplicationDate.Text.Trim();

                        //objEWA.Reason = txtReason.Text.Trim();
                        //objEWA.OrgId = Convert.ToInt32(Session["OrgId"].ToString());
                        //objEWA.LeaveStatus = "waiting";
                        DataTable details = db.DbCon("select FirstName+' '+Middlename+' '+LastName as Name,Email,FromDate,TODATE,LeaveStatus Status,HRNote from tblLeaveApplication inner join " +
                                                     " tblEmployee on tblEmployee.UserCode=tblLeaveApplication.UserCode where ApplicationId=" + id + " and tblLeaveApplication.OrgId='" + Session["OrgId"].ToString() + "'");
                        //Email = db.getDbstatus_Value("select Email from tblEmployee where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + ucode.ToString() + "'");
                        //Name = db.getDbstatus_Value("SELECT FirstName + ' ' + MiddleName + ' ' + LastName AS   FullName from tblEmployee where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + ucode.ToString() + "'");


                        Email    = details.Rows[0]["Email"].ToString();
                        Name     = details.Rows[0]["Name"].ToString();
                        Status   = details.Rows[0]["Status"].ToString();
                        FromDate = details.Rows[0]["FromDate"].ToString();
                        ToDate   = details.Rows[0]["TODATE"].ToString();
                        string HRNote = details.Rows[0]["HRNote"].ToString();

                        SendEmails(FromDate, ToDate, Name, Email, Status, HRNote);

                        DataTable dt  = db.DbCon("select * from Trailset1 where OrgId='" + Session["OrgId"].ToString() + "'");
                        DataTable dt1 = db.DbCon("select distinct md.UserCode, md.ApplicationId,TokenId,'Leave' as Subject, Reason as MessageContent,OrgName from tblUser inner join tblLeaveApplication md on md.UserCode = tblUser.UserCode inner join tblOrganization o on o.OrganizationId = tblUser.OrgId where  md.ApplicationId ='" + id + "' AND md.OrgID = '" + Session["OrgId"].ToString() + "'");

                        if (dt1.Rows.Count > 0 && dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt1.Rows.Count; i++)
                            {
                                SendPushNotification(dt1.Rows[i]["TokenId"].ToString(), "Leave " + Status, dt1.Rows[i]["OrgName"].ToString()
                                                     , dt.Rows[0]["SenderId"].ToString(), dt.Rows[0]["AppKey"].ToString());
                            }
                        }
                        //objEWA.dtLeaveDetails = ViewState["tempLeaveDetails"] as DataTable;

                        //count = db.getDb_Value("select  count(ApplicationId)   from  tblLeaveApplication where LeaveStatus='" + "waiting" + "' and   UserCode='" + objEWA.UserCode + "' and  OrgID='" + objEWA.OrgId + "'  ");
                        //if (count != 0)
                        //{
                        //    db.cnopen();
                        //    db.insert("update tblLeaveApplication set LeaveStatus='" + "Approved" + "' where UserCode='" + objEWA.UserCode + "' and  OrgID='" + objEWA.OrgId + "'");
                        //    //db.insert("insert into tbl_aproveleave values('" + objEWA.UserCode + "','" + System.DateTime.Now.ToString("dd/MM/yyyy") + "','" + txtFrom.Text + "','" + txtTo.Text + "','" + objEWA.TotalLeave + "','" + txtReason.Text + "','" + objEWA.OrgId + "','" + "Approved" + "')");
                        //    db.cnclose();
                        //}
                    }
                }
                if (count > 0)
                {
                    msgBox.ShowMessage("Record Updated Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);

                    ClearControls();
                }
                else
                {
                    msgBox.ShowMessage("Unable to  Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                }

                //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }

            catch (Exception exp)
            {
                GeneralErr(exp.Message);
            }
        }