コード例 #1
0
        public CommonModal UpdatePassword(RegistrationModel a)
        {
            CommonModal e1         = new CommonModal();
            string      encrypt_pw = encryptPassword(a.passWord);

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@passWord", SqlDbType.NVarChar).Value = encrypt_pw;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value     = a.mode;
            cmd.Parameters.Add("@token", SqlDbType.NVarChar).Value    = a.token;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();

            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["MSG"].ToString();
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "password update Failed";
            }
            return(e1);
        }
コード例 #2
0
        public string confirmregistration(string token)
        {
            CommonModal   e2    = new CommonModal();
            SqlConnection conn1 = new SqlConnection(commonCode.conStr);

            conn1.Open();
            SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn1);

            cmd1.CommandType = CommandType.StoredProcedure;
            cmd1.Parameters.Add("@token", SqlDbType.NVarChar).Value = token;

            cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "UPDATETOKEN";
            int n = (int)cmd1.ExecuteNonQuery();

            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd1;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn1.Close();
            if (Dt.Rows.Count > 0)
            {
                return("<div style='text-align:center'>Your eMail is verified.<br/><a href='http://rmcnet.in/#/login'>Please click here to login on RMCNET</a></div>");
            }
            else
            {
                return("Registration Failed");
            }
        }
コード例 #3
0
        public CommonModal getLogindetails(string mobile_No)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = mobile_No;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = "GET_LOGIN_DETAILS";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = "True";
                e1.ResponseMessage = Dt.Rows[0]["Message"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Login Failed!! Please Check username and Password";
                e1.data            = Dt;
            }
            return(e1);
        }
コード例 #4
0
        public CommonModal verifyotp(SendMobileMessage sm)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@login_Id", SqlDbType.NVarChar).Value = sm.login_Id;
            cmd.Parameters.Add("@otp", SqlDbType.NVarChar).Value      = sm.otp;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value     = "verifyotp";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["Msg"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Verification Failed!!";
                // e1.data = Dt;
            }
            return(e1);
        }
コード例 #5
0
        public CommonModal sendMobileMessage(SendMobileMessage sms)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);
            SqlCommand    cmd  = new SqlCommand("Pro_SendMobileMessage", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = sms.mobile_No;
            cmd.Parameters.Add("@otp", SqlDbType.NVarChar).Value       = GenerateNewRandom();
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = sms.mode;
            conn.Open();
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["MSG"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Error in c#";
            }
            return(e1);
        }
コード例 #6
0
        public CommonModal insert(FavouriteModel a)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_favourite", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@login_id", SqlDbType.Int).Value    = a.login_id;
            cmd.Parameters.Add("@category_id", SqlDbType.Int).Value = a.category_id;
            cmd.Parameters.Add("@ad_id", SqlDbType.Int).Value       = a.ad_id;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value   = a.mode;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["MSG"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Ad Posting Failed";
            }
            return(e1);
        }
コード例 #7
0
        public CommonModal getLogindetails()
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_AdminCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "GET";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = "True";
                e1.ResponseMessage = "Data Successfully Received";
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Data Failed";
                e1.data            = Dt;
            }
            return(e1);
        }
コード例 #8
0
        public CommonModal Insert(AdJobModel a)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_Adjobmaster", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value              = a.login_Id;
            cmd.Parameters.Add("@category_Id", SqlDbType.Int).Value           = a.category_Id;
            cmd.Parameters.Add("@subCategory_Id ", SqlDbType.Int).Value       = a.subCategory_Id;
            cmd.Parameters.Add("@Job_Title", SqlDbType.NVarChar).Value        = a.Job_Title;
            cmd.Parameters.Add("@JobType", SqlDbType.NVarChar).Value          = a.JobType;
            cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value      = a.Description;
            cmd.Parameters.Add("@Salary_From", SqlDbType.Int).Value           = a.Salary_From;
            cmd.Parameters.Add("@Salary_To", SqlDbType.Int).Value             = a.Salary_To;
            cmd.Parameters.Add("@Contact_Person", SqlDbType.NVarChar).Value   = a.Contact_Person;
            cmd.Parameters.Add("@Mobile_No", SqlDbType.NVarChar).Value        = a.Mobile_No;
            cmd.Parameters.Add("@Landline_No", SqlDbType.NVarChar).Value      = a.Landline_No;
            cmd.Parameters.Add("@Experience", SqlDbType.NVarChar).Value       = a.Experience;
            cmd.Parameters.Add("@Location", SqlDbType.NVarChar).Value         = a.Location;
            cmd.Parameters.Add("@location_id", SqlDbType.NVarChar).Value      = a.location_id;
            cmd.Parameters.Add("@payment_status ", SqlDbType.Int).Value       = a.payment_status;
            cmd.Parameters.Add("@Addressofcompany", SqlDbType.NVarChar).Value = a.Addressofcompany;
            cmd.Parameters.Add("@image1", SqlDbType.NVarChar).Value           = a.image1;

            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = a.mode;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt  = ds.Tables[0];
            DataTable Dt1 = ds.Tables[1];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Job Apply Failed";
            }
            return(e1);
        }
コード例 #9
0
        public CommonModal insert(CompanycomplaintModel a)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_companycomplaints", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ad_compy_id", SqlDbType.Int).Value            = a.ad_compy_id;
            cmd.Parameters.Add("@login_id", SqlDbType.Int).Value               = a.login_id;
            cmd.Parameters.Add("@name_loadgcompt", SqlDbType.NVarChar).Value   = a.name_loadgcompt;
            cmd.Parameters.Add("@name_compy", SqlDbType.NVarChar).Value        = a.name_compy;
            cmd.Parameters.Add("@mobileno", SqlDbType.NVarChar).Value          = a.mobileno;
            cmd.Parameters.Add("@name_defaultcompy", SqlDbType.NVarChar).Value = a.name_defaultcompy;
            cmd.Parameters.Add("@appro_compy", SqlDbType.Int).Value            = a.appro_compy;
            cmd.Parameters.Add("@detail_persncont", SqlDbType.NVarChar).Value  = a.detail_persncont;
            cmd.Parameters.Add("@amount", SqlDbType.Int).Value = a.amount;
            cmd.Parameters.Add("@durat_pend_pay", SqlDbType.NVarChar).Value = a.durat_pend_pay;
            cmd.Parameters.Add("@category_id", SqlDbType.Int).Value         = a.category_id;
            cmd.Parameters.Add("@location", SqlDbType.NVarChar).Value       = a.location;
            cmd.Parameters.Add("@location_id", SqlDbType.NVarChar).Value    = a.location_id;
            cmd.Parameters.Add("@image1", SqlDbType.NVarChar).Value         = a.image1;
            cmd.Parameters.Add("@payment_status", SqlDbType.Int).Value      = a.payment_status;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value           = a.mode;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt  = ds.Tables[0];
            DataTable Dt1 = ds.Tables[1];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Ad Posting Failed";
            }
            return(e1);
        }
コード例 #10
0
        public CommonModal OnlynumberCheckpassword(string mobile_No, string password)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = mobile_No;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = "CHECKPASSWORD1";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                if (decrypePassword(password, Dt.Rows[0]["passWord"].ToString()))
                {
                    e1 = getLogindetails(mobile_No);
                }
                else
                {
                    e1.ResponseStatus  = "False";
                    e1.ResponseMessage = "Password Wrong";
                    e1.data            = Dt;
                }
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Number Wrong";
                e1.data            = Dt;
            }
            return(e1);
        }
コード例 #11
0
        public CommonModal Checkpassword(RegistrationModel l)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value  = l.login_Id;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "CHECKPASSWORD";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                if (decrypePassword(l.passWord, Dt.Rows[0]["passWord"].ToString()))
                {
                    e1 = updateLogindetails(l.login_Id, l.passWordnew);
                }
                else
                {
                    e1.ResponseStatus  = "False";
                    e1.ResponseMessage = "Old Password Wrong";
                    e1.data            = Dt;
                }
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Old Password Wrong";
                e1.data            = Dt;
            }
            return(e1);
        }
コード例 #12
0
        public CommonModal ForgetPassword(ForgetPasswordModel a)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@email_Id", SqlDbType.NVarChar).Value   = a.email_Id;
            cmd.Parameters.Add("@ip_Address", SqlDbType.NVarChar).Value = a.ip_Address;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value       = a.mode;

            //   cmd.Parameters.Add("@token", SqlDbType.NVarChar).Value = token;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                string name  = Dt.Rows[0]["name"].ToString();
                string token = Dt.Rows[0]["token"].ToString();
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["MSG"].ToString();
                SendEmail(a.email_Id, "Password Reset - RMCNET", "<div><b>Hi " + name + "</b>,<br/><br/>  Please click the below link to reset your password <br/> http://rmcnet.in/#/changepassword?token=" + token + "<br/><br/><br/>Best Regards," + "<br/><span style='color: Tomato; '><b>RMCNET TEAM</b></span>" + "</div>");
                //e1.data = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Change Password Failed";
            }
            return(e1);
        }
コード例 #13
0
        public CommonModal Update(RegistrationModel a)
        {
            CommonModal e1 = new CommonModal();
            //string encrypt_pw = encryptPassword(a.passWord);
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value        = a.login_Id;
            cmd.Parameters.Add("@first_Name", SqlDbType.NVarChar).Value = a.first_Name;
            cmd.Parameters.Add("@last_Name", SqlDbType.NVarChar).Value  = a.last_Name;
            cmd.Parameters.Add("@email_Id", SqlDbType.NVarChar).Value   = a.email_Id;

            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = a.mode;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt  = ds.Tables[0];
            DataTable Dt1 = ds.Tables[1];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = "True";
                e1.ResponseMessage = "Update Successfull";
                e1.data            = Dt1;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Registration Failed";
            }
            return(e1);
        }
コード例 #14
0
        public CommonModal updateLogindetails(int login_Id, string passWordnew)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value      = login_Id;
            cmd.Parameters.Add("@passWord", SqlDbType.NVarChar).Value = encryptPassword(passWordnew);

            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "Update_Password";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["Msg"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Password Update failed";
                e1.data            = Dt;
            }
            return(e1);
        }
コード例 #15
0
        public CommonModal getLogin(RegistrationModel l)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = l.mobile_No;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = "GETHASH_PWD";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                if (Convert.ToInt32(Dt.Rows[0]["is_Active"]) == 0)
                {
                    SqlConnection conn1 = new SqlConnection(commonCode.conStr);
                    conn1.Open();
                    SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    string otp = GenerateNewRandom();
                    cmd1.Parameters.Add("@otp", SqlDbType.NVarChar).Value       = otp;
                    cmd1.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = l.mobile_No;
                    cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = "SECOND_TIME_NEW_OTP";
                    DataSet        ds1 = new DataSet();
                    SqlDataAdapter da1 = new SqlDataAdapter();
                    da1.SelectCommand = cmd1;
                    da1.Fill(ds1);
                    DataTable Dt1 = ds1.Tables[0];
                    conn1.Close();

                    e1.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                    e1.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                    e1.data            = Dt1;
                    return(e1);
                }
                else if (decrypePassword(l.passWord, Dt.Rows[0]["passWord"].ToString()))
                {
                    e1 = getLogindetails(l.mobile_No);
                }
                else
                {
                    e1.ResponseStatus  = "False";
                    e1.ResponseMessage = "Login Failed - Password Wrong";
                    e1.data            = Dt;
                }
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Login Failed - Mobile Number not registered";
                e1.data            = Dt;
            }

            return(e1);
        }
コード例 #16
0
        public CommonModal onlynuberlogin(RegistrationModel a)
        {
            CommonModal e1 = new CommonModal();

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = a.mobile_No;
            //cmd.Parameters.Add("@userType_Id", SqlDbType.Int).Value = a.userType_Id;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "ONLYNUMBERLOGIN";
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();

            if (Dt.Rows.Count > 0)
            {
                if (Convert.ToInt32(Dt.Rows[0]["is_Active"]) == 0)
                {
                    SqlConnection conn1 = new SqlConnection(commonCode.conStr);
                    conn1.Open();
                    SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    string otp = GenerateNewRandom();
                    cmd1.Parameters.Add("@otp", SqlDbType.NVarChar).Value       = otp;
                    cmd1.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value = a.mobile_No;
                    cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value      = "SECOND_TIME_NEW_OTP";
                    DataSet        ds1 = new DataSet();
                    SqlDataAdapter da1 = new SqlDataAdapter();
                    da1.SelectCommand = cmd1;
                    da1.Fill(ds1);
                    DataTable Dt1 = ds1.Tables[0];
                    conn1.Close();

                    e1.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                    e1.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                    e1.data            = Dt1;
                    // return e1;
                }

                else if (Convert.ToInt32(Dt.Rows[0]["is_Active"]) == 1)
                {
                    e1.ResponseStatus  = "True";
                    e1.ResponseMessage = "";
                    e1.data            = Dt;
                }



                else
                {
                    string      link       = "";
                    CommonModal e2         = new CommonModal();
                    string      encrypt_pw = encryptPassword(a.mobile_No);

                    SqlConnection conn1 = new SqlConnection(commonCode.conStr);
                    conn1.Open();
                    SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn1);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    string email_id = "rmcnet" + a.mobile_No + "@gmail.com";



                    string otp = GenerateNewRandom();
                    cmd1.Parameters.Add("@otp", SqlDbType.NVarChar).Value      = otp;
                    cmd1.Parameters.Add("@passWord", SqlDbType.NVarChar).Value = encrypt_pw;
                    cmd1.Parameters.Add("@email_Id", SqlDbType.NVarChar).Value = email_id;
                    //cmd1.Parameters.Add("@last_Name", SqlDbType.NVarChar).Value = a.last_Name;
                    cmd1.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value  = a.mobile_No;
                    cmd1.Parameters.Add("@userType_Id", SqlDbType.Int).Value     = a.userType_Id;
                    cmd1.Parameters.Add("@ip_Address", SqlDbType.NVarChar).Value = a.ip_Address;
                    cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value       = "Newnumberregistration";
                    string token = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
                    cmd1.Parameters.Add("@token", SqlDbType.NVarChar).Value      = token;
                    cmd1.Parameters.Add("@web_mobile", SqlDbType.NVarChar).Value = a.web_mobile;
                    DataSet        ds1 = new DataSet();
                    SqlDataAdapter da1 = new SqlDataAdapter();
                    da1.SelectCommand = cmd1;
                    da1.Fill(ds1);
                    DataTable Dt1 = ds1.Tables[0];
                    conn1.Close();

                    if (Dt1.Rows.Count > 0)
                    {
                        e2.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                        e2.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                        e2.data            = Dt1;
                    }
                    else
                    {
                        e2.ResponseStatus  = "False";
                        e2.ResponseMessage = "Registration Failed";
                    }


                    return(e2);
                }
            }
            return(e1);
        }
コード例 #17
0
        public async System.Threading.Tasks.Task <CommonModal> imageFileUpload()
        {
            var    httpPostedFile = HttpContext.Current.Request.Files["Content"];
            string file_name      = HttpContext.Current.Request.Headers["file_name"];
            string ad_compy_id    = HttpContext.Current.Request.Headers["ad_compy_id"];
            string image          = HttpContext.Current.Request.Headers["image"];

            int index = file_name.LastIndexOf('.');

            string fileExtension = file_name.Substring(index);
            var    timestamp     = DateTime.Now.ToString("yyyyMMddHHmmsstt");

            file_name = "IMG" + timestamp + fileExtension;
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("pro_dropbox", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            CommonModal e1 = new CommonModal();

            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "UPLOAD_FILE";
            List <UploadFile> getDropboxDetails = new List <UploadFile>();
            DataSet           ds = new DataSet();
            SqlDataAdapter    da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();
            getDropboxDetails = commonCode.ConvertDataTable <UploadFile>(Dt);
            var             folderPath           = getDropboxDetails[0].Upload_Path;
            string          URLAuth              = folderPath; //URL path
            var             token                = getDropboxDetails[0].App_Token;
            var             folderName           = "{\"path\": \"/" + getDropboxDetails[0].Folder_Name + "/" + file_name + "\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}";
            var             httpRequest          = HttpContext.Current.Request;
            string          Response             = null;
            HttpWebRequest  WebReq               = null;
            HttpWebResponse WebRes               = null;
            StreamReader    StreamResponseReader = null;
            Stream          requestStream        = null;

            try
            {
                foreach (string file in httpRequest.Files)
                {
                    var postedFile = httpRequest.Files[file];
                    WebReq                           = (HttpWebRequest)WebRequest.Create(URLAuth);
                    WebReq.Method                    = "POST";
                    WebReq.Accept                    = "*/*";
                    WebReq.Timeout                   = 50000;
                    WebReq.KeepAlive                 = false;
                    WebReq.AllowAutoRedirect         = false;
                    WebReq.AllowWriteStreamBuffering = true;
                    WebReq.Headers.Add("Dropbox-API-Arg", folderName);
                    WebReq.Headers.Add("authorization", "Bearer " + token);
                    WebReq.ContentType   = "application/octet-stream";
                    WebReq.ContentLength = postedFile.ContentLength;

                    BinaryReader b = new BinaryReader(httpPostedFile.InputStream);
                    byte[]       converted_File = b.ReadBytes(httpPostedFile.ContentLength);


                    //using (var reader = new BinaryReader(postedFile.InputStream))
                    //{
                    //    imgData = reader.ReadBytes(postedFile.ContentLength);
                    //}

                    requestStream = WebReq.GetRequestStream();
                    requestStream.Write(converted_File, 0, postedFile.ContentLength);

                    requestStream.Close();

                    WebRes = (HttpWebResponse)WebReq.GetResponse();
                    StreamResponseReader = new StreamReader(WebRes.GetResponseStream(), Encoding.UTF8);
                    Response             = StreamResponseReader.ReadToEnd();
                    result1 = "Success";
                    //   return result1;
                }
            }
            catch (Exception e)
            {
                throw;
                result1 = "Failure";
                //  return result1;
            }

            ///**** Getting the Share Link Begins ******///
            if (result1 == "Success")
            {
                SqlConnection conn3 = new SqlConnection(commonCode.conStr);
                conn3.Open();
                SqlCommand cmd3 = new SqlCommand("pro_dropbox", conn3);
                cmd3.CommandType = CommandType.StoredProcedure;

                cmd3.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "SHARE_PATH";
                List <ShareLink> getDropboxDetailsFile = new List <ShareLink>();
                DataSet          dsFile = new DataSet();
                SqlDataAdapter   daFile = new SqlDataAdapter();
                daFile.SelectCommand = cmd3;
                daFile.Fill(dsFile);
                DataTable DtFile = dsFile.Tables[0];
                conn3.Close();
                getDropboxDetailsFile = commonCode.ConvertDataTable <ShareLink>(DtFile);
                var token2 = getDropboxDetailsFile[0].App_Token;

                //Finding List Share path
                var listSharePathData = "{\"path\":  \"/" + getDropboxDetailsFile[0].Folder_Name + "/" + file_name + "\", \"direct_only\": true}";
                //  var listSharePathData = "{\"path\":  \"/" + getDropboxDetailsFile[0].Folder_Name + "/"  + "\", \"direct_only\": true}";

                //     var listSharePathData = "{\"path\": \"/+"+ getDropboxDetailsFile[0].Folder_Name + "/" + file_name + "\",\"settings\": {\"requested_visibility\": \"public\",\"audience\": \"public\",\"access\": \"editor\"}}";

                //{ 'path': " + getDropboxDetails[0].Folder_Name + ",'autorename :' 'false'}";
                var    List_shared_Path = getDropboxDetailsFile[0].List_shared_Path;
                string URLAuth2         = List_shared_Path; //URL path


                using (var stringContent = new StringContent(listSharePathData, System.Text.Encoding.UTF8, "application/json"))
                    using (var client = new HttpClient())
                    {
                        try
                        {
                            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token2);
                            var response = await client.PostAsync(URLAuth2, stringContent);

                            var result = await response.Content.ReadAsStringAsync();

                            Console.WriteLine(result);



                            //Finding Share path
                            var sharePathData = "{\"path\":  \"/" + getDropboxDetailsFile[0].Folder_Name + "/" + file_name + "\" ,\"settings\": { \"requested_visibility\": \"public\"}}";
                            //  var sharePathData = "{\"path\":  \"/" + getDropboxDetailsFile[0].Folder_Name + "/"  + "\" ,\"settings\": { \"requested_visibility\": \"public\"}}";

                            //{ 'path': " + getDropboxDetails[0].Folder_Name + ",'autorename :' 'false'}";
                            var    Share_Path = getDropboxDetailsFile[0].Share_Path;
                            string URLAuth3   = Share_Path; //URL path
                            using (var stringContent1 = new StringContent(sharePathData, System.Text.Encoding.UTF8, "application/json"))
                                using (var client1 = new HttpClient())
                                {
                                    try
                                    {
                                        client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
                                        var response1 = await client.PostAsync(URLAuth3, stringContent1);

                                        var result3 = await response1.Content.ReadAsStringAsync();

                                        Console.WriteLine(result3);
                                        // ListData[] arr1 = JObject.Parse(result1)["url"];
                                        result3 = JObject.Parse(result3)["url"].ToString();
                                        var download_File = result3.Remove(result3.Length - 4, 4) + "raw=1";
                                        // str = str.Remove(str.Length - 1, 1) + ",";
                                        attachmentURL = download_File;
                                        CommonModal   e2    = new CommonModal();
                                        SqlConnection conn1 = new SqlConnection(commonCode.conStr);
                                        conn1.Open();
                                        SqlCommand cmd1 = new SqlCommand("Pro_companycomplaints", conn1);
                                        cmd1.CommandType = CommandType.StoredProcedure;
                                        cmd1.Parameters.Add("@ad_compy_id", SqlDbType.Int).Value = ad_compy_id;
                                        cmd1.Parameters.Add("@image", SqlDbType.NVarChar).Value  = image;
                                        cmd1.Parameters.Add("@image1", SqlDbType.NVarChar).Value = attachmentURL;
                                        cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value   = "UPDATE";
                                        int n = (int)cmd1.ExecuteNonQuery();
                                        conn1.Close();
                                        e1.ResponseMessage = "Image uploaded successfully";
                                        e1.ResponseStatus  = "True";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.ForegroundColor = ConsoleColor.Red;
                                        Console.WriteLine(ex.Message);
                                        Console.ResetColor();
                                        e1.ResponseMessage = "Image upload failed";
                                        e1.ResponseStatus  = "False";
                                    }
                                }
                        }
                        catch (Exception ex)
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine(ex.Message);
                            Console.ResetColor();
                            e1.ResponseMessage = "Image upload failed";
                            e1.ResponseStatus  = "False";
                        }
                    }
            }



            return(e1);
        }
コード例 #18
0
        public CommonModal Onlynumberverifyotp(SendMobileMessage sm)
        {
            CommonModal e1 = new CommonModal();

            if (sm.mode1 == 1)
            {
                SqlConnection conn = new SqlConnection(commonCode.conStr);
                conn.Open();
                SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@login_Id", SqlDbType.NVarChar).Value = sm.login_Id;
                cmd.Parameters.Add("@otp", SqlDbType.NVarChar).Value      = sm.otp;

                cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "verifyotp1";
                DataSet        ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                da.Fill(ds);
                DataTable Dt = ds.Tables[0];
                conn.Close();
                if (Dt.Rows[0]["status"].ToString().Equals("True"))
                {
                    CommonModal   e2         = new CommonModal();
                    string        encrypt_pw = encryptPassword(sm.passWord);
                    SqlConnection conn1      = new SqlConnection(commonCode.conStr);
                    conn1.Open();
                    SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn1);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.Add("@login_Id", SqlDbType.Int).Value      = sm.login_Id;
                    cmd1.Parameters.Add("@passWord", SqlDbType.NVarChar).Value = encrypt_pw;
                    cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value     = "updatepassword1";
                    int n = (int)cmd1.ExecuteNonQuery();
                    conn1.Close();
                    //DataSet ds1 = new DataSet();
                    //SqlDataAdapter da1 = new SqlDataAdapter();
                    //da1.SelectCommand = cmd1;
                    //da1.Fill(ds1);
                    //DataTable Dt1 = ds1.Tables[0];
                    //conn1.Close();

                    e2.ResponseStatus  = "True";
                    e2.ResponseMessage = "Registration success";


                    e2.data = Dt;
                    return(e2);
                }

                else
                {
                    e1.ResponseStatus  = "False";
                    e1.ResponseMessage = "Verification Failed!!";
                    // e1.data = Dt;
                }
                return(e1);
            }
            else
            {
                e1 = OnlynumberCheckpassword(sm.mobile_No, sm.passWord);
                return(e1);
            }
        }
コード例 #19
0
        public CommonModal Insert(RegistrationModel a)
        {
            string      link       = "";
            CommonModal e1         = new CommonModal();
            string      encrypt_pw = encryptPassword(a.passWord);

            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_LoginCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            string email_id = "";

            if (a.email_Id == null || a.email_Id == "")
            {
                email_id = a.first_Name + a.last_Name + "@gmail.com";
                cmd.Parameters.Add("@email_Id", SqlDbType.NVarChar).Value = email_id;
            }
            else
            {
                cmd.Parameters.Add("@email_Id", SqlDbType.NVarChar).Value = a.email_Id;
            }

            string otp = GenerateNewRandom();

            cmd.Parameters.Add("@otp", SqlDbType.NVarChar).Value        = otp;
            cmd.Parameters.Add("@passWord", SqlDbType.NVarChar).Value   = encrypt_pw;
            cmd.Parameters.Add("@first_Name", SqlDbType.NVarChar).Value = a.first_Name;
            cmd.Parameters.Add("@last_Name", SqlDbType.NVarChar).Value  = a.last_Name;
            cmd.Parameters.Add("@mobile_No", SqlDbType.NVarChar).Value  = a.mobile_No;
            cmd.Parameters.Add("@userType_Id", SqlDbType.Int).Value     = a.userType_Id;
            cmd.Parameters.Add("@ip_Address", SqlDbType.NVarChar).Value = a.ip_Address;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value       = a.mode;
            string token = Convert.ToBase64String(Guid.NewGuid().ToByteArray());

            cmd.Parameters.Add("@token", SqlDbType.NVarChar).Value      = token;
            cmd.Parameters.Add("@web_mobile", SqlDbType.NVarChar).Value = a.web_mobile;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt = ds.Tables[0];

            conn.Close();

            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt.Rows[0]["MSG"].ToString();
                e1.data            = Dt;

                //SqlConnection conn1 = new SqlConnection(commonCode.conStr);
                //conn1.Open();
                //SqlCommand cmd1 = new SqlCommand("Pro_LoginCRUD", conn);
                //cmd1.CommandType = CommandType.StoredProcedure;
                //cmd1.Parameters.Add("@mode", SqlDbType.NVarChar).Value = "LINKURL";
                //DataSet ds1 = new DataSet();
                //SqlDataAdapter da1 = new SqlDataAdapter();
                //da1.SelectCommand = cmd1;
                //da1.Fill(ds1);
                //DataTable Dt1 = ds1.Tables[0];
                //conn1.Close();

                //link = Dt1.Rows[0]["link"].ToString();



                //  SendEmail(a.email_Id, "Confirm Registration", "<div><b>Welcome to RMCNET</b>,<br/><br/>  Please click the below link to confirm to your registration " + link + token+ "<br/><br/><br/>Best Regards,"+ "<br/><span style='color: Tomato; '><b>RMCNET</b></span>" + "</div>");
                //e1.data = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Registration Failed";
            }
            return(e1);
        }
コード例 #20
0
        public CommonModal Insert(AdPostModel a)
        {
            CommonModal   e1   = new CommonModal();
            SqlConnection conn = new SqlConnection(commonCode.conStr);

            conn.Open();
            SqlCommand cmd = new SqlCommand("Pro_AdCRUD", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ad_Id", SqlDbType.Int).Value                  = a.ad_Id;
            cmd.Parameters.Add("@login_Id", SqlDbType.Int).Value               = a.login_Id;
            cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value              = a.name;
            cmd.Parameters.Add("@price", SqlDbType.Int).Value                  = a.price;
            cmd.Parameters.Add("@description", SqlDbType.NVarChar).Value       = a.description;
            cmd.Parameters.Add("@category_Id", SqlDbType.Int).Value            = a.category_Id;
            cmd.Parameters.Add("@subCategory_Id", SqlDbType.Int).Value         = a.subCategory_Id;
            cmd.Parameters.Add("@companyName", SqlDbType.NVarChar).Value       = a.companyName;
            cmd.Parameters.Add("@contactPerson", SqlDbType.NVarChar).Value     = a.contactPerson;
            cmd.Parameters.Add("@mobileNo", SqlDbType.NVarChar).Value          = a.mobileNo;
            cmd.Parameters.Add("@landlineNo", SqlDbType.NVarChar).Value        = a.landlineNo;
            cmd.Parameters.Add("@Parking", SqlDbType.NVarChar).Value           = a.Parking;
            cmd.Parameters.Add("@Features", SqlDbType.NVarChar).Value          = a.Features;
            cmd.Parameters.Add("@SuperBuildUparea", SqlDbType.NVarChar).Value  = a.SuperBuildUparea;
            cmd.Parameters.Add("@PlotArea", SqlDbType.NVarChar).Value          = a.PlotArea;
            cmd.Parameters.Add("@CallibrateDate", SqlDbType.NVarChar).Value    = a.CallibrateDate;
            cmd.Parameters.Add("@CallibrateMachine", SqlDbType.NVarChar).Value = a.CallibrateMachine;
            cmd.Parameters.Add("@GSTNumber", SqlDbType.NVarChar).Value         = a.GSTNumber;
            cmd.Parameters.Add("@PlantCapacity", SqlDbType.NVarChar).Value     = a.PlantCapacity;
            cmd.Parameters.Add("@companyAddress", SqlDbType.NVarChar).Value    = a.companyAddress;
            cmd.Parameters.Add("@plantCompany", SqlDbType.NVarChar).Value      = a.plantCompany;
            cmd.Parameters.Add("@modelYear", SqlDbType.NVarChar).Value         = a.modelYear;
            cmd.Parameters.Add("@serialNo", SqlDbType.NVarChar).Value          = a.serialNo;
            cmd.Parameters.Add("@newCost", SqlDbType.Int).Value                = a.newCost;
            cmd.Parameters.Add("@expectCost", SqlDbType.Int).Value             = a.expectCost;
            cmd.Parameters.Add("@location", SqlDbType.NVarChar).Value          = a.location;
            cmd.Parameters.Add("@location_id", SqlDbType.NVarChar).Value       = a.location_id;
            cmd.Parameters.Add("@comment", SqlDbType.NVarChar).Value           = a.comment;
            cmd.Parameters.Add("@image1", SqlDbType.NVarChar).Value            = a.image1;
            cmd.Parameters.Add("@payment_status", SqlDbType.Int).Value         = a.payment_status;
            cmd.Parameters.Add("@category", SqlDbType.NVarChar).Value          = a.category;
            cmd.Parameters.Add("@no_labours", SqlDbType.Int).Value             = a.no_labours;
            cmd.Parameters.Add("@available", SqlDbType.NVarChar).Value         = a.available;
            cmd.Parameters.Add("@mode", SqlDbType.NVarChar).Value              = a.mode;
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            da.Fill(ds);
            DataTable Dt  = ds.Tables[0];
            DataTable Dt1 = ds.Tables[1];

            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                e1.ResponseStatus  = Dt1.Rows[0]["status"].ToString();
                e1.ResponseMessage = Dt1.Rows[0]["MSG"].ToString();
                e1.data            = Dt;
            }
            else
            {
                e1.ResponseStatus  = "False";
                e1.ResponseMessage = "Ad Posting Failed";
            }
            return(e1);
        }