Пример #1
0
		void btnOK_Click(object sender, RoutedEventArgs e)
		{
			try
			{
				if (txtUserNameID.Text != "" && pwdPasssword.Password != "" && txtEmail.Text != "")
				{
                    lblValidate.Content = string.Empty;
                    string emailStr = txtEmail.Text;
                    int indexAt = emailStr.IndexOf('@');
                    strPassword = encodestring(pwdPasssword.Password);
                    string substremail = emailStr.Substring(indexAt + 1);
                    int indexDot = substremail.IndexOf('.');
                    indexDot = indexDot + indexAt + 1;
                    int lengthEmail = emailStr.Length;
                    if (indexAt >= 1 && indexDot >= 3 && (indexDot - indexAt) >= 2 && lengthEmail >= 5)
                    {
                        
                        if (strPassword.Length < 6)
                        {
                            lblValidate.Content = "6 Characters for Password";
                        }
                        else if (!validate_text())
                        {
                            lblValidate.Content = "Only Characters(a-z) allow";
                        }
                        else
                        {
                            ClsUser objUser = new ClsUser();
                            
                            objUser.ID = -1;
                            objUser.DisplayName = txtUserNameID.Text.Trim();
                            objUser.RoleID = 2;
                            objUser.FName = txtUserNameID.Text.Trim();
                            objUser.LName = "";
                            objUser.EMail = txtEmail.Text;
                            objUser.PassWord = strPassword;
                            objUser.IsActive = true;
                            objUser.CreatedBy = 1;
                            objUser.ModifiedBy = 1;

                            objUser.RatePerHour = 0;
                            objUser.OverTimeRate = 0;
                            objUser.DoubleRatePerHour = 0;
                            objUser.DoubleOverTimeRate = 0;

                            lblValidate.Content = "Registering....";
                            while (VMuktiAPI.VMuktiInfo.MainConnectionString == string.Empty)
                            {
                                lblValidate.Content = "Try After Some Time.";
                            }
                           int retID = objUser.Save();

                           if (retID == 0)
                           {
                               lblValidate.Content = "Already Registered.";
                               VMuktiAPI.VMuktiHelper.CallEvent("BandwidthUsage", null, null);
                           }
                           else
                           {
                               lblValidate.Content = "User Created Successfully.";
                               txtUserNameID.Text = "";
                               pwdPasssword.Password = "";
                               strPassword = "";
                               txtEmail.Text = "";
                               for (int i = 0; i < cnvMain.Children.Count; i++)
                               {
                                   if (((UIElement)cnvMain.Children[i]).GetType().ToString() == "System.Windows.Controls.Label")
                                   {
                                       if (((Label)cnvMain.Children[i]).Name == "lbemail")
                                       {
                                           cnvMain.Children.RemoveAt(i);
                                       }
                                   }

                                   if (((UIElement)cnvMain.Children[i]).GetType().ToString() == "System.Windows.Controls.TextBox")
                                   {
                                       if (((TextBox)cnvMain.Children[i]).Name == "txtEmail")
                                       {
                                           cnvMain.Children.RemoveAt(i);
                                       }
                                   }

                                   if (((UIElement)cnvMain.Children[i]).GetType().ToString() == "System.Windows.Controls.Button")
                                   {
                                       if (((Button)cnvMain.Children[i]).Name == "btnok")
                                       {
                                           cnvMain.Children.RemoveAt(i);
                                       }
                                   }

                                   if (((UIElement)cnvMain.Children[i]).GetType().ToString() == "System.Windows.Controls.Button")
                                   {
                                       if (((Button)cnvMain.Children[i]).Name == "btncan")
                                       {
                                           cnvMain.Children.RemoveAt(i);
                                       }
                                   }
                               }

                               btnSignUp.Visibility = Visibility.Visible;
                               btnLogIn.Visibility = Visibility.Visible;

                               #region ALPA

                               VMukti.Business.ClsUser.AddRecord();

                               #endregion
                           }
                           
                        }
                    }
                    else
                    {
                        lblValidate.Content = "Please Enter a valid Email ID";
                    }

               
				}
				else
				{
					lblValidate.Content = "Feilds cant left blank";
				}
			}
			catch (Exception ex)
			{
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "BtnOK_Click()", "Controls\\CtlLogin.xaml.cs");
			}
		}
Пример #2
0
        private void Authenticate()
        {
            lock (this)
            {
                try
                {
                    //StreamReader sReader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\DomainStatus.txt");
                    //string strStatus = sReader.ReadToEnd();
                    //sReader.Close();

                    FileStream   fs        = new FileStream(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\DomainStatus.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
                    StreamReader sReader   = new StreamReader(fs);
                    string       strStatus = sReader.ReadToEnd();
                    sReader.Close();
                    fs.Close();


                    bool isSuperNode = false;
                    strPassword = encodestring(pwdPasssword.Password);
                    if (strStatus == "Initializing")
                    {
                        dispTimer4DomainLoading.Stop();
                        lblValidate.Content = "Checking....";

                        if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithNetP2P)
                        {
                            isSuperNode = false;
                        }
                        else if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.SuperNode)
                        {
                            isSuperNode = true;
                        }
                        if (VMuktiAPI.VMuktiInfo.MainConnectionString == string.Empty)
                        {
                            //ClsException.WriteToLogFile("calling bs join method");

                            CallBootStrapHTTPJoin();

                            //ClsException.WriteToLogFile("called bs join");
                        }

                        if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrAuthType == AuthType.SQLAuthentication)
                        {
                            {
                                //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                //sb.AppendLine("During Login");
                                //sb.AppendLine("User is about to authorised");
                                //sb.AppendLine("Username:"******"PassWord:"******"getting the username and pass from main db");

                                CurrenUser = VMukti.Business.ClsUser.GetByUNamePass(txtUserNameID.Text, strPassword, ref AuthResult);
                                if (CurrenUser == null)
                                {
                                    if (AuthResult)
                                    {
                                        //System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
                                        //sb2.AppendLine("During Login");
                                        //sb2.AppendLine("user has enter worng password");
                                        //sb2.AppendLine("Username:"******"PassWord:"******"Invalid UserName, Password!!";
                                        txtUserNameID.IsEnabled = true;
                                        pwdPasssword.IsEnabled  = true;
                                        pwdPasssword.Focus();
                                    }
                                    else
                                    {
                                        //System.Text.StringBuilder sb3 = new System.Text.StringBuilder();
                                        //sb3.AppendLine("During Login");
                                        //sb3.AppendLine("user has enter wrong username");
                                        //sb3.AppendLine("Username:"******"PassWord:"******"Invalid UserName, Password!!";
                                        txtUserNameID.IsEnabled = true;
                                        pwdPasssword.IsEnabled  = true;
                                        txtUserNameID.Focus();
                                    }
                                    btnLogIn.IsEnabled  = true;
                                    btnSignUp.IsEnabled = true;
                                    return;
                                }
                                else
                                {
                                    //System.Text.StringBuilder sb4 = new System.Text.StringBuilder();
                                    //sb4.AppendLine("During Login");
                                    //sb4.AppendLine("User login Successfully");
                                    //sb4.AppendLine("Username:"******"PassWord:"******"Online";
                                    VMuktiAPI.VMuktiInfo.CurrentPeer.RoleName     = CurrenUser.RoleName;
                                    VMuktiAPI.VMuktiInfo.CurrentPeer.CampaignID   = CurrenUser.CampaignID;
                                    VMuktiAPI.VMuktiInfo.CurrentPeer.CampaignName = CurrenUser.CampaignName;
                                    VMuktiAPI.VMuktiInfo.CurrentPeer.ScriptID     = CurrenUser.ScriptID;

                                    #region ALPA

                                    VMukti.Business.ClsUser.InsertRecord(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);

                                    #endregion
                                }
                            }
                            try
                            {
                                //ClsException.WriteToLogFile("calling bs authorized user ");
                                App.chHttpBootStrapService.svcHttpBSAuthorizedUser(txtUserNameID.Text.Trim(), VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP, isSuperNode);
                                //ClsException.WriteToLogFile("called bs auth user");
                            }
                            catch (System.ServiceModel.EndpointNotFoundException ex)
                            {
                                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Authenticate()", "Controls\\CtlLogin.xaml.cs");
                                VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                            }
                            catch (System.ServiceModel.CommunicationException exp)
                            {
                                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "Authenticate()--1", "Controls\\CtlLogin.xaml.cs");
                                VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                            }
                            if (VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP != "")
                            {
                                try
                                {
                                    //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    //sb.AppendLine("Login:"******"Opening Supernode Client");
                                    //sb.AppendLine("SuperNodeIP:" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP);
                                    //sb.AppendLine(sb1.ToString());
                                    //ClsLogging.WriteToTresslog(sb);

                                    //ClsException.WriteToLogFile("opening http sp client");

                                    App.chHttpSuperNodeService = (IHttpSuperNodeService)App.objHttpSuperNode.OpenClient <IHttpSuperNodeService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/HttpSuperNode");
                                    App.chHttpSuperNodeService.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName, VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString());

                                    //ClsException.WriteToLogFile("opened http sp client");


                                    //System.Text.StringBuilder sb5 = new System.Text.StringBuilder();
                                    //sb5.AppendLine("Login:"******"supernode client open successfully.");
                                    //sb5.AppendLine("SuperNodeIP:" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP);
                                    //sb5.AppendLine(sb1.ToString());
                                    //ClsLogging.WriteToTresslog(sb5);
                                }
                                catch (System.ServiceModel.EndpointNotFoundException ex)
                                {
                                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Authenticate()--2", "Controls\\CtlLogin.xaml.cs");
                                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                                }
                                catch (System.ServiceModel.CommunicationException exp)
                                {
                                    VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "Authenticate()--4", "Controls\\CtlLogin.xaml.cs");
                                }
                            }

                            if (EntAutherized != null)
                            {
                                lblValidate.Content = "";
                                this.Visibility     = Visibility.Collapsed;
                                EntAutherized();
                                VMuktiAPI.VMuktiHelper.CallEvent("SucessfulLogin", this, new VMuktiAPI.VMuktiEventArgs(new object[] { txtUserNameID.Text }));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Authenticate()--5", "Controls\\CtlLogin.xaml.cs");
                    txtUserNameID.IsEnabled = true;
                    pwdPasssword.IsEnabled  = true;
                    btnLogIn.IsEnabled      = true;
                    btnSignUp.IsEnabled     = true;
                    lblValidate.Content     = "Can not connect to bootstrap server.";
                    VMuktiAPI.VMuktiHelper.CallEvent("BandwidthUsage", null, null);
                }
            }
        }
Пример #3
0
        public static ClsUser GetByUNamePass(string UName, string Password, ref bool Result)
        {
            try
            {
                ClsUser obj = new ClsUser();

                if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
                {
                    List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                    clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                    objInfo.Direction = "Input";
                    objInfo.PName = "@pID";
                    objInfo.PValue = -1;
                    objInfo.PDBType = "Int";
                    objInfo.PSize = 200;

                    clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                    objInfo2.Direction = "Input";
                    objInfo2.PName = "@pUName";
                    objInfo2.PValue = UName;
                    objInfo2.PDBType = "NVarChar";
                    objInfo2.PSize = 200;

                    clsSqlParametersInfo objInfo3 = new clsSqlParametersInfo();
                    objInfo3.Direction = "Input";
                    objInfo3.PName = "@pPass";
                    objInfo3.PValue = Password;
                    objInfo3.PDBType = "NVarChar";
                    objInfo3.PSize = 200;

                    clsSqlParametersInfo objInfo4 = new clsSqlParametersInfo();
                    objInfo4.Direction = "InputOutput";
                    objInfo4.PName = "@pResult";
                    objInfo4.PValue = false;
                    objInfo4.PDBType = "Bit";
                    objInfo4.PSize = 200;


                    lstSP.Add(objInfo);
                    lstSP.Add(objInfo2);
                    lstSP.Add(objInfo3);
                    lstSP.Add(objInfo4);

                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;

                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByUNamePass(string UName, string Password, ref bool Result)", "clsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByUNamePass(string UName, string Password, ref bool Result)", "clsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }

                    if (!obj.MapData(ds.Tables[0])) obj = null;

                    if (obj != null && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
                    {
                        obj.MapData4Campaign(ds.Tables[1].Rows[0]);
                    }
                }
                else
                {
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                {                  
                    List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                    clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                    objInfo.Direction = "Input";
                    objInfo.PName = "@pID";
                    objInfo.PValue = -1;
                    objInfo.PDBType = "Int";
                    objInfo.PSize = 200;

                    clsSqlParametersInfo objInfo2 = new clsSqlParametersInfo();
                    objInfo2.Direction = "Input";
                    objInfo2.PName = "@pUName";
                    objInfo2.PValue = UName;
                    objInfo2.PDBType = "NVarChar";
                    objInfo2.PSize = 200;

                    clsSqlParametersInfo objInfo3 = new clsSqlParametersInfo();
                    objInfo3.Direction = "Input";
                    objInfo3.PName = "@pPass";
                    objInfo3.PValue = Password;
                    objInfo3.PDBType = "NVarChar";
                    objInfo3.PSize = 200;

                    clsSqlParametersInfo objInfo4 = new clsSqlParametersInfo();
                    objInfo4.Direction = "InputOutput";
                    objInfo4.PName = "@pResult";
                    objInfo4.PValue = false;
                    objInfo4.PDBType = "Bit";
                    objInfo4.PSize = 200;                                                        
                    

                    lstSP.Add(objInfo);
                    lstSP.Add(objInfo2);
                    lstSP.Add(objInfo3);
                    lstSP.Add(objInfo4);
                    
                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;

                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByUNamePass(string UName, string Password, ref bool Result)", "clsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByUNamePass(string UName, string Password, ref bool Result)", "clsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }

                    if (!obj.MapData(ds.Tables[0])) obj = null;

                    if (obj != null && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
                    {
                        obj.MapData4Campaign(ds.Tables[1].Rows[0]);
                    }

                }
                else
                {
                    DataSet ds = new VMukti.DataAccess.ClsUserDataService().User_GetByUNamePass(UName, Password, ref Result);

                    if (!obj.MapData(ds.Tables[0])) obj = null;

                    if (obj != null && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
                    {
                        obj.MapData4Campaign(ds.Tables[1].Rows[0]);
                    }
                }
                }
                return obj;
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "GetByUNamePass()", "clsUser.cs");
                return null;
            }
        }
Пример #4
0
        public static ClsUser GetByGroupID(int ID)
        {
            try
            {
                ClsUser obj = new ClsUser();

                if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
                {
                    List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                    clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                    objInfo.Direction = "Input";
                    objInfo.PName = "@pID";
                    objInfo.PValue = ID;
                    objInfo.PDBType = "Int";
                    objInfo.PSize = 200;

                    lstSP.Add(objInfo);

                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;
                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByGroupID(int ID)", "ClsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByGroupID(int ID)", "ClsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }

                    if (!obj.MapData(ds.Tables[0])) obj = null;
                }
                else
                {
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                {
                    
                    List<clsSqlParametersInfo> lstSP = new List<clsSqlParametersInfo>();

                    clsSqlParametersInfo objInfo = new clsSqlParametersInfo();
                    objInfo.Direction = "Input";
                    objInfo.PName = "@pID";
                    objInfo.PValue = ID;
                    objInfo.PDBType = "Int";
                    objInfo.PSize = 200;

                    lstSP.Add(objInfo);

                    clsSqlParameterContract CSqlInfo = new clsSqlParameterContract();
                    CSqlInfo.objParam = lstSP;
                    DataSet ds;
                    try
                    {
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.EndpointNotFoundException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByGroupID(int ID)", "ClsUser.cs");                       
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                    catch (System.ServiceModel.CommunicationException e)
                    {
                        VMuktiHelper.ExceptionHandler(e, "GetByGroupID(int ID)", "ClsUser.cs");
                        VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                        ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spGUserInfoPayroll", CSqlInfo).dsInfo;
                    }
                   
                    if (!obj.MapData(ds.Tables[0])) obj = null;
                }
                else
                {
                    DataSet ds = new VMukti.DataAccess.ClsUserDataService().User_GetByID(ID);

                    if (!obj.MapData(ds.Tables[0])) obj = null;
                }
                }
                return obj;
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "GetByGroupId()", "clsUser.cs");  
                return null;
            }
        }
Пример #5
0
        public static void AddNewRecord(int uid)
        {

            if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
            {
                List<clsSqlParametersInfo> lstSP1 = new List<clsSqlParametersInfo>();

                ClsUser objUser = new ClsUser();

                clsSqlParametersInfo objUserInfo1 = new clsSqlParametersInfo();
                objUserInfo1.Direction = "Input";
                objUserInfo1.PName = "@uid";
                objUserInfo1.PValue = uid;
                objUserInfo1.PDBType = "Int";
                objUserInfo1.PSize = 200;

                lstSP1.Add(objUserInfo1);


                //clsSqlParametersInfo objUserInfo2 = new clsSqlParametersInfo();
                //objUserInfo2.Direction = "Input";
                //objUserInfo2.PName = "@dt";
                //objUserInfo2.PValue = dt;
                //objUserInfo2.PDBType = "DateTime";
                //objUserInfo2.PSize = 200;
                //lstSP1.Add(objUserInfo2);

                clsSqlParameterContract CSqlUserInfo = new clsSqlParameterContract();
                CSqlUserInfo.objParam = lstSP1;

                try
                {
                    //   VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spAEUserInfoPayroll", CSqlInfo).ToString();
                    VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spLogout", CSqlUserInfo);
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "Save(IDbTransaction txn)", "ClsUser.cs");
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                }
            }
            else
            {

            if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
            {
                List<clsSqlParametersInfo> lstSP1 = new List<clsSqlParametersInfo>();

                ClsUser objUser = new ClsUser();

                clsSqlParametersInfo objUserInfo1 = new clsSqlParametersInfo();
                objUserInfo1.Direction = "Input";
                objUserInfo1.PName = "@uid";
                objUserInfo1.PValue = uid;
                objUserInfo1.PDBType = "Int";
                objUserInfo1.PSize = 200;

                lstSP1.Add(objUserInfo1);


                //clsSqlParametersInfo objUserInfo2 = new clsSqlParametersInfo();
                //objUserInfo2.Direction = "Input";
                //objUserInfo2.PName = "@dt";
                //objUserInfo2.PValue = dt;
                //objUserInfo2.PDBType = "DateTime";
                //objUserInfo2.PSize = 200;
                //lstSP1.Add(objUserInfo2);

                clsSqlParameterContract CSqlUserInfo = new clsSqlParameterContract();
                CSqlUserInfo.objParam = lstSP1;

                try
                {
                    //   VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spAEUserInfoPayroll", CSqlInfo).ToString();
                    VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spLogout", CSqlUserInfo);
                }
                catch (System.ServiceModel.EndpointNotFoundException e)
                {
                    VMuktiHelper.ExceptionHandler(e, "Save(IDbTransaction txn)", "ClsUser.cs");                  
                    VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                }
            }
            else
            {
                new VMukti.DataAccess.ClsUserDataService().User_AddNewRecord(uid);
                }
            }
        }
Пример #6
0
        public static DataSet FindBuddy(string username, string email)
        //public static DataSet FindBuddy()
        {
            try
            {

                if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) && VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap)
                {
                    List<clsSqlParametersInfo> lstSP1 = new List<clsSqlParametersInfo>();

                    ClsUser objUser = new ClsUser();

                    clsSqlParametersInfo objUserInfo1 = new clsSqlParametersInfo();
                    objUserInfo1.Direction = "Input";
                    objUserInfo1.PName = "@uname";
                    objUserInfo1.PValue = username;
                    objUserInfo1.PDBType = "nvarchar";
                    objUserInfo1.PSize = 100;

                    lstSP1.Add(objUserInfo1);

                    clsSqlParametersInfo objUserInfo2 = new clsSqlParametersInfo();
                    objUserInfo2.Direction = "Input";
                    objUserInfo2.PName = "@email";
                    objUserInfo2.PValue = email;
                    objUserInfo2.PDBType = "nvarchar";
                    objUserInfo2.PSize = 256;

                    lstSP1.Add(objUserInfo2);



                    clsSqlParameterContract CSqlUserInfo = new clsSqlParameterContract();
                    CSqlUserInfo.objParam = lstSP1;

                    DataSet ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spFindBuddy", CSqlUserInfo).dsInfo;

                    return ds;
                    //VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spAEUserInfoPayroll", CSqlInfo).ToString();
                    //VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spFindBuddy", CSqlUserInfo);
                    
                }
                else
                {


                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                {
                    List<clsSqlParametersInfo> lstSP1 = new List<clsSqlParametersInfo>();

                    ClsUser objUser = new ClsUser();

                    clsSqlParametersInfo objUserInfo1 = new clsSqlParametersInfo();
                    objUserInfo1.Direction = "Input";
                    objUserInfo1.PName = "@uname";
                    objUserInfo1.PValue = username;
                    objUserInfo1.PDBType = "nvarchar";
                    objUserInfo1.PSize = 100;

                    lstSP1.Add(objUserInfo1);

                    clsSqlParametersInfo objUserInfo2 = new clsSqlParametersInfo();
                    objUserInfo2.Direction = "Input";
                    objUserInfo2.PName = "@email";
                    objUserInfo2.PValue = email;
                    objUserInfo2.PDBType = "nvarchar";
                    objUserInfo2.PSize = 256;

                    lstSP1.Add(objUserInfo2);



                    clsSqlParameterContract CSqlUserInfo = new clsSqlParameterContract();
                    CSqlUserInfo.objParam = lstSP1;

                    DataSet ds = VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("spFindBuddy", CSqlUserInfo).dsInfo;

                    return ds;
                    //VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spAEUserInfoPayroll", CSqlInfo).ToString();
                    //VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spFindBuddy", CSqlUserInfo);
                }
                else
                {
                    //return new VMukti.DataAccess.ClsUserDataService().User_FindBuddy();
                    return new VMukti.DataAccess.ClsUserDataService().User_FindBuddy(username, email);
                }
            }
            }
            catch (System.ServiceModel.EndpointNotFoundException e)
            {
                VMuktiHelper.ExceptionHandler(e, "FindBuddy", "ClsUser.cs");
                VMuktiAPI.VMuktiHelper.CallEvent("GetSuperNodeIP", null, null);
                return null;
                //VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteReturnNonQuery("spLogin", CSqlUserInfo);
            }
        }