Exemplo n.º 1
0
        public HttpResponseMessage CreateOTPRegistraion(dynamic SearchForm)
        {
            try
            {
                string Email = string.Empty;
                Email = (string)SearchForm.Email;
                string OTPType = string.Empty;
                OTPType = (string)SearchForm.OTPType;
                UserClass CLE = new UserClass();
                DataTable dt  = new DataTable();
                dt = CLE.FN_CreateOTPRegistraion(Email, OTPType);
                string OTPCode = "";

                if (dt.Rows.Count > 0)
                {
                    OTPCode = dt.Rows[0]["OPTCode"].ToString();
                    string     Emails    = dt.Rows[0]["email"].ToString();
                    string     OTPtext   = "Use  below code to  " + OTPType + " your Account (The below otp is only for " + OTPType + " Account)";
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("otp.htm");
                    EmailText = EmailText.Replace("XXXOTPTypeXX", OTPtext).Replace("XXOTPXX", OTPCode);
                    try { OBJ.sendMail(Emails, "OTP code for registration", EmailText); } catch { }
                }

                return(Request.CreateResponse(HttpStatusCode.OK, OTPCode));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_Internal_Server_Error"));
            }
        }
Exemplo n.º 2
0
        public string FN_Register(RegisterShape LoginUser, string IPAddress, out string RegNO)
        {
            string        status      = "";
            string        AppMstRegNo = "";
            SqlConnection con         = new SqlConnection(method.str);
            SqlCommand    com         = new SqlCommand("Insertdata5", con);

            com.CommandType    = CommandType.StoredProcedure;
            com.CommandTimeout = 99999999;
            com.Parameters.AddWithValue("@SessionID", LoginUser.SponsorId.Trim());
            com.Parameters.AddWithValue("@sponserID", LoginUser.SponsorId.Trim());
            com.Parameters.AddWithValue("@AppMstFName", LoginUser.Name.Trim());
            com.Parameters.AddWithValue("@mobile", "NA");
            com.Parameters.AddWithValue("@emailid", LoginUser.Email.Trim());
            com.Parameters.AddWithValue("@AppMstleftright", LoginUser.Position.Trim());
            com.Parameters.AddWithValue("@BTCAddres", "NA");
            com.Parameters.AddWithValue("@country", LoginUser.country.Trim());
            com.Parameters.AddWithValue("@Pwd", LoginUser.Password.Trim());
            com.Parameters.AddWithValue("@IPAddress", IPAddress);
            com.Parameters.AddWithValue("@Key", LoginUser.Password.Trim());
            com.Parameters.AddWithValue("@OTP", LoginUser.OTP.Trim());
            com.Parameters.Add("@regDisplay", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
            com.Parameters.Add("@flag", SqlDbType.VarChar, 50).Direction       = ParameterDirection.Output;
            com.Parameters.Add("@flagpwd", SqlDbType.VarChar, 50).Direction    = ParameterDirection.Output;

            try
            {
                con.Open();
                com.CommandTimeout = 999999;
                com.ExecuteNonQuery();
                RegNO = com.Parameters["@regDisplay"].Value.ToString();
                string flagpwd = com.Parameters["@flagpwd"].Value.ToString();
                status = com.Parameters["@flag"].Value.ToString();
                if (status == "1")
                {
                    AppMstRegNo = status;
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("successful.htm");
                    EmailText = EmailText.Replace("XXNameXX", LoginUser.Name.Trim().ToUpper()).Replace("XXusernameXX", RegNO).Replace("XXpasswordXX", flagpwd);
                    try { OBJ.sendMail(LoginUser.Email.Trim(), "Welcome To XS COIN", EmailText); } catch { }
                }

                else
                {
                    AppMstRegNo = status;
                }
            }
            catch (Exception ex)
            {
                RegNO       = "";
                AppMstRegNo = status;
            }

            return(AppMstRegNo);
        }
Exemplo n.º 3
0
        public IHttpActionResult CreateNewEmail(ClassEmail email)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

            mail.From = new MailAddress(email.From);
            mail.To.Add("*****@*****.**");
            mail.Subject           = email.Subject;
            mail.Body              = email.Body;
            SmtpServer.Port        = 25;
            SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "j123456e");
            SmtpServer.EnableSsl   = true;
            SmtpServer.Send(mail);
            return(Ok());
        }
Exemplo n.º 4
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            this._inscrialu.idcuota          = this.dgvHistorialCuotas[0, this.dgvHistorialCuotas.CurrentCell.RowIndex].Value.ToString();
            this._inscrialu.numcuota         = int.Parse(this.dgvHistorialCuotas[1, this.dgvHistorialCuotas.CurrentCell.RowIndex].Value.ToString()) + 1;
            this._inscrialu.idcurso          = this._idcurso;
            this._inscrialu.fecharealpago    = DateTime.Parse(this.txtFechaRealPago.Text).ToString("yyyy/MM/dd");
            this._inscrialu.fechaproximopago = DateTime.Parse(this.txtFechaPago.Text).AddMonths(1).ToString("yyyy/MM/dd");
            this._inscrialu.montocuota       = Decimal.Parse(this.txtMontoCuota.Text);
            this._inscrialu.montopagado      = Decimal.Parse(this.txtAlumnoPaga.Text);
            this._inscrialu.montosaldo       = Decimal.Parse(this.txtMontoDeuda.Text);

            this._inscrialu.accion           = "N";
            this._inscrialu.fechaaccion      = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");
            this._inscrialu.idempleadoaccion = 1; //Viene del login
            this._inscrialu.idpuntoaccion    = 1; //Viene del login

            this.dgvHistorialCuotas.DataSource = this._inscrialu.ABMCuotasSocios(this._inscrialu, "CuotasSocio");
            this.dgvHistorialCuotas.DataMember = "CuotasSocio";

            if (this.dgvHistorialCuotas.Rows.Count > 0)
            {
                //Idcurso
                this.dgvHistorialCuotas.Columns[0].Visible = false;
                //Fecha real pago
                this.dgvHistorialCuotas.Columns[2].Visible = false;

                //se inicio proceso de notificación de envio por mail del pago de cuota

                this.email = new ClassEmail();

                if (this.email.PagoCuota(this.txtEmail.Text, this.txtPunto.Text, this.txtFechaRealPago.Text, this.txtApellido.Text + ", " + this.txtNombre.Text, this.txtTipoClase.Text, this.txtNombreClase.Text, this.txtMontoCuota.Text, this.dgvHistorialCuotas[1, this.dgvHistorialCuotas.CurrentCell.RowIndex].Value.ToString(), this.txtDebePagar.Text, this.txtAlumnoPaga.Text, this.txtMontoSaldo.Text, DateTime.Parse(this.txtFechaPago.Text).AddMonths(1).ToString("dd/MM/yyyy")) == true)
                {
                    //se finaliza notificación del envio de mail de pago de cuota
                    MessageBox.Show("Acción realizada con exito!!!", "Atención!!!");
                }
                else
                {
                    MessageBox.Show("No se pudo enviar mail a cliente!!!", "Error!!!");
                }
            }
        }
        public HttpResponseMessage ForgetPassword(dynamic LoginUser)
        {
            try
            {
                string Login = string.Empty;

                Login = (string)LoginUser.LoginID;
                ClassUserAccount Resp     = new ClassUserAccount();
                DataTable        dt       = new DataTable();
                string           Password = "";
                string           Email    = "";
                string           Name     = "";
                dt = Resp.FN_ForgetPassword(Login);

                if (dt.Rows.Count > 0)
                {
                    Password = dt.Rows[0]["AppMstPassword"].ToString();
                    Email    = dt.Rows[0]["email"].ToString();
                    Name     = dt.Rows[0]["AppMstFName"].ToString();
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("forgotpass.htm");
                    EmailText = EmailText.Replace("XXNameXX", Name.ToUpper()).Replace("XXUserIDXX", Login).Replace("XXPaswordIDXX", Password);
                    try { OBJ.sendMail(Email, "Password", EmailText); } catch { }

                    return(Request.CreateResponse(HttpStatusCode.OK, new { USERID = Email }));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.Unauthorized, "UserID and Passwrod invalid"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_INTERNAL_SERVER_ERROR"));
            }
        }
    protected void btnallocate_Click(object sender, EventArgs e)
    {
        try
        {
            if (grvRequest.SelectedIndex < 0)
            {
                lblmsg.Text = "Please select request to allocate."; return;
            }
            if (ddlallocateto.SelectedIndex == 0)
            {
                lblmsg.Text = "Please select Allocate To."; ddlallocateto.Focus(); return;
            }

            string strUpdateReq = "Update RequestMaster set AlloToEmpCode='" + ddlallocateto.SelectedItem.Value + "',AlloDate=getdate(),AlloByEmpCode='" + Session["EmpCode"].ToString() + "',ReqStatus='Progress' where reqID=" + lblReqID.Text;
            strUpdateReq = objdb.ExecuteInsertUpdate(strUpdateReq);
            if (strUpdateReq != "" && strUpdateReq != null && strUpdateReq != "0")
            {
                lblmsg.Text = "Request allocated."; tblAllocateto.Visible = false;

                //send email
                if (ConfigurationManager.AppSettings["sendemail"] == "Y")
                {
                    //get request details
                    DataSet ds = new DataSet();
                    ds = new DataSet();
                    ds = objdb.GetDataset("select * from RequestMaster where  reqID=" + lblReqID.Text, "RequestMaster");
                    DataRow rrm;
                    rrm = ds.Tables["RequestMaster"].Rows[0];


                    //get req by employee details
                    ds = new DataSet();
                    ds = objdb.GetDataset("select * from empmaster where empcode='" + rrm["reqbyempcode"].ToString() + "'", "empmaster");
                    DataRow remp;
                    remp = ds.Tables["empmaster"].Rows[0];

                    //get allocate emp details
                    ds = new DataSet();
                    ds = objdb.GetDataset("select * from empmaster where empcode='" + rrm["AlloToEmpCode"].ToString() + "'", "empmaster");
                    DataRow raemp;
                    raemp = ds.Tables["empmaster"].Rows[0];


                    //get request tat
                    ds = new DataSet();
                    ds = objdb.GetDataset("select * from ReqTypeMaster where ReqIypeId=" + rrm["ReqTypeMasterID"].ToString() + "", "ReqTypeMaster");
                    DataRow r;
                    r = ds.Tables["ReqTypeMaster"].Rows[0];

                    int tat;
                    tat = int.Parse(r["ReqTat"].ToString());

                    string dt = DateTime.Now.AddDays(tat).ToString("dd-MMM-yy hh:mm");

                    //send email

                    string strbody = "Dear " + remp["empname"].ToString() + ",<br><br> Your request no " + lblReqID.Text + " is allocated to " + raemp["empname"].ToString() + ". Your request will be completed on or before " + dt.ToString() + "<br><hr>" +
                                     "<b>Request Id : </b>" + lblReqID.Text + "<br>" +
                                     "<b>Request Date : </b>" + DateTime.Parse(rrm["ReqDate"].ToString()).ToString("dd-MMM-yy hh:mm") + "<br>" +
                                     "<b>Request Type : </b>" + r["reqtype"].ToString() + "<br>" +
                                     "<b>Request :</b> " + rrm["request"].ToString() + "<hr>" +

                                     "<br><br>Regards<br>RMS Team.";
                    string tomail;
                    tomail = remp["email"].ToString() + "," + raemp["email"].ToString();
                    String Ans = ClassEmail.SendMail(tomail, tomail, "RMS - Request No " + lblReqID.Text + " Allocated", strbody);
                    if (Ans == "OK")
                    {
                    }
                }



                ShowRequestGrid();
            }
            else
            {
                lblmsg.Text = "Error :" + objdb.returnMsg;
            }
        }
        catch (Exception ex) { lblmsg.Text = "Error : " + ex.Message.ToString(); }
    }