示例#1
0
        public static bool DeleteFile(int fileID, string username)
        {
            bool sts = false;

            try
            {
                using (DBClass context = new DBClass())
                {
                    context.AddParameter("@FileID", fileID);
                    context.AddParameter("@userName", username);
                    if ((context.ExecuteNonQuery("deleteUploadFile", CommandType.StoredProcedure)) > 0)
                    {
                        sts = true;
                    }
                    else
                    {
                        sts = false;
                    }
                }
            }
            catch
            {
                return(sts);
            }
            return(sts);
        }
示例#2
0
        public static List <ClientsRecord> GetClients()
        {
            List <ClientsRecord> clientList = new List <ClientsRecord>();  // creating list of model.

            DataSet ds = new DataSet();

            char[] delimiterChars = { '@' };
            //string[] RolesForCurrentUser = Roles.GetAllRoles();
            //string[] user = Roles.GetUsersInRole(RolesForCurrentUser[0]);
            // string userName = Roles.GetRolesForUser();
            //string username = HttpContext.Current.User.Identity.Name;
            string username = "";

            if (HttpContext.Current.Session["UserName"] != null)
            {
                username = HttpContext.Current.Session["UserName"].ToString();
            }
            else
            {
                username = "";
            }
            using (DBClass context = new DBClass())
            {
                context.AddParameter("@username", username);
                ds = context.ExecuteDataSet("getUserRole", CommandType.StoredProcedure);
            }
            using (DBClass context = new DBClass())
            {
                context.AddParameter("@UserRole", ds.Tables[0].Rows[0]["UserRole"].ToString());
                context.AddParameter("@UserName", username);
                DataTable dt = context.getData("getFileWithStatus", CommandType.StoredProcedure);
                // loop for adding add from dataset to list<modeldata>
                foreach (DataRow dr in dt.Rows)
                {
                    //string[] fName = Convert.ToString(dr["FilePath"]).Split(delimiterChars);
                    clientList.Add(new ClientsRecord
                    {
                        Serial        = Convert.ToInt32(dr["ID"]),
                        UserRole      = ds.Tables[0].Rows[0]["UserRole"].ToString(),
                        Company       = Convert.ToString(dr["uCompanyName"]),
                        Phone         = Convert.ToString(dr["uMobile_No"]),
                        EmailID       = Convert.ToString(dr["Email_ID"]),
                        FileName      = Convert.ToString(dr["FileName"]),
                        PaymentStatus = Convert.ToBoolean(dr["Status"]),
                        ReportStatus  = Convert.ToBoolean(dr["UploadStatus"]),
                        AnalysisCost  = Convert.ToDouble(dr["Amount"]),
                        ReportingDate = Convert.ToDateTime(dr["ReportingTime"])
                    });
                }
                return(clientList);
            }
        }
示例#3
0
        public static List <Enquiry> getAllEnquiry(string UserRole)
        {
            List <Enquiry> enquiryList = new List <Enquiry>();  // creating list of model.
            string         username    = HttpContext.Current.Session["UserName"].ToString();
            DataTable      dt          = new DataTable();

            using (DBClass context = new DBClass())
            {
                if (UserRole == "Client")
                {
                    context.AddParameter("@UserName", username);
                    dt = context.getData("getEnquiryByUser", CommandType.StoredProcedure);
                }
                else
                {
                    dt = context.getData("getAllEnquiry", CommandType.StoredProcedure);
                }
                foreach (DataRow dr in dt.Rows)
                {
                    string EnquiryStatus = "NO";
                    context.AddParameter("@EnquiryID", Convert.ToString(dr["ID"]));
                    context.AddParameter("@UserName", username);
                    DataSet dtStatus = context.ExecuteDataSet("getEnquiryStatus", CommandType.StoredProcedure);
                    if (dtStatus.Tables[0].Rows.Count > 0)
                    {
                        EnquiryStatus = "YES";
                    }

                    enquiryList.Add(new Enquiry
                    {
                        EnquiryID      = Convert.ToString(dr["ID"]),
                        UserName       = Convert.ToString(dr["UserName"]),
                        Enq_Category   = Convert.ToString(dr["EnquiryCategory"]),
                        Enq_Subject    = Convert.ToString(dr["EnquirySubject"]),
                        EnquiryDetail1 = Convert.ToString(dr["EnquiryDetail"]),
                        Enq_CreateDate = Convert.ToString(dr["CreateDate"]),
                        Buyer_Count    = Convert.ToInt32(dr["Buyer_Count"]),
                        Country        = Convert.ToString(dr["Country"]),
                        City           = Convert.ToString(dr["City"]),
                        State          = Convert.ToString(dr["State"]),
                        eStatus        = EnquiryStatus
                    });
                }
                return(enquiryList);
            }
        }