Beispiel #1
0
 private void Edit(int id)
 {
     try
     {
         InstituteBLL instituteBLL = new InstituteBLL();
         DataTable    dt           = instituteBLL.GetById(id);
         if (dt != null)
         {
             if (dt.Rows.Count > 0)
             {
                 this.ModelId            = Convert.ToInt32(Convert.ToString(dt.Rows[0]["InstituteId"]));
                 this.ModelCode          = Convert.ToString(dt.Rows[0]["InstituteCode"]);
                 txtName.Text            = Convert.ToString(dt.Rows[0]["Name"]);
                 imgLogo.Src             = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["Logo"]))) ? "~/Assets/images/avater-public.png" : FilePath.Institute + Convert.ToString(dt.Rows[0]["Logo"]);
                 this.ModelLogo          = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["Logo"]))) ? string.Empty : Convert.ToString(dt.Rows[0]["Logo"]);
                 txtUrl.Text             = Convert.ToString(dt.Rows[0]["Url"]);
                 txtDescription.Text     = Convert.ToString(dt.Rows[0]["Description"]);
                 txtSerialNumber.Text    = Convert.ToString(dt.Rows[0]["SerialNumber"]);
                 ddlCourse.SelectedValue = Convert.ToString(dt.Rows[0]["CourseId"]);
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to edit.");
     }
 }
Beispiel #2
0
        private void LoadCounter()
        {
            try
            {
                InstituteBLL instituteBLL = new InstituteBLL();
                DataTable    dtInstitute  = instituteBLL.GetAllActive();
                lblTotalUniversity.Text = Convert.ToString(dtInstitute.Rows.Count);

                LenderBankBLL lenderBankBLL = new LenderBankBLL();
                DataTable     dtLenderBank  = lenderBankBLL.GetAllActive();
                lblTotalBank.Text = Convert.ToString(dtLenderBank.Rows.Count);

                CourseBLL courseBLL = new CourseBLL();
                DataTable dtCourse  = courseBLL.GetAllActive();
                lblTotalCourse.Text = Convert.ToString(dtCourse.Rows.Count);

                BlogPostBLL blogPostBLL = new BlogPostBLL();
                DataTable   dtBlogPost  = blogPostBLL.GetAllActive();
                lblTotalBlogPost.Text = Convert.ToString(dtBlogPost.Rows.Count);

                UserBLL   userBLL = new UserBLL();
                DataTable dtUser  = userBLL.GetAllActiveMember();
                lblTotalMember.Text = Convert.ToString(dtUser.Rows.Count);
            }
            catch (Exception)
            {
                //throw;
            }
        }
Beispiel #3
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             InstituteBLL instituteBLL = new InstituteBLL();
             Institutes   institute    = new Institutes();
             institute.InstituteId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (institute.InstituteId > 0)
             {
                 if (instituteBLL.Delete(institute))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
Beispiel #4
0
 private void LoadList()
 {
     try
     {
         InstituteBLL instituteBLL = new InstituteBLL();
         DataTable    dt           = instituteBLL.GetAll();
         rptrList.DataSource = dt;
         rptrList.DataBind();
     }
     catch (Exception)
     {
         //throw;
     }
 }
Beispiel #5
0
        private void LoadTopInstitutes()
        {
            try
            {
                InstituteBLL instituteBLL = new InstituteBLL();
                DataTable    dt           = instituteBLL.GetAllActiveTop();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        rptrTopInstitute.DataSource = dt;
                        rptrTopInstitute.DataBind();
                    }
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }
Beispiel #6
0
 private void GenerateCode()
 {
     try
     {
         QuaintLibraryManager lib = new QuaintLibraryManager();
         ModelCode = CodePrefix.Institute + "-" + lib.GetSixDigitNumber(1);
         InstituteBLL instituteBLL = new InstituteBLL();
         DataTable    dt           = instituteBLL.GetAll();
         if (dt != null)
         {
             if (dt.Rows.Count > 0)
             {
                 string[] lastCode       = dt.Rows[dt.Rows.Count - 1]["InstituteCode"].ToString().Split('-');
                 int      lastCodeNumber = Convert.ToInt32(lastCode[1]);
                 ModelCode = CodePrefix.Institute + "-" + lib.GetSixDigitNumber(lastCodeNumber + 1);
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to load.");
     }
 }
        private void LoadList(int courseId)
        {
            try
            {
                InstituteBLL instituteBLL = new InstituteBLL();
                DataTable    dt           = new DataTable();

                if (courseId > 0)
                {
                    dt = instituteBLL.GetByCourseId(courseId);
                }
                else
                {
                    dt = instituteBLL.GetAllActive();
                }

                rptrList.DataSource = dt;
                rptrList.DataBind();
            }
            catch (Exception)
            {
                //throw;
            }
        }
Beispiel #8
0
        private void SaveAndUpdate()
        {
            try
            {
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    Alert(AlertType.Warning, "Enter institute name.");
                    txtName.Focus();
                }
                else if (string.IsNullOrEmpty(txtSerialNumber.Text))
                {
                    Alert(AlertType.Warning, "Enter serial number");
                    txtSerialNumber.Focus();
                }
                else if (ddlCourse.SelectedIndex < 1)
                {
                    Alert(AlertType.Warning, "Select course.");
                    ddlCourse.Focus();
                }
                else
                {
                    string name         = Convert.ToString(txtName.Text);
                    string url          = Convert.ToString(txtUrl.Text);
                    string description  = Convert.ToString(txtDescription.Text);
                    int    serialNumber = Convert.ToInt32(txtSerialNumber.Text);
                    int    courseId     = Convert.ToInt32(ddlCourse.SelectedValue);
                    string logo         = string.Empty;
                    if (fuLogo.HasFile)
                    {
                        logo = UploadLogo();
                    }
                    else
                    {
                        logo = this.ModelLogo;
                    }

                    InstituteBLL instituteBLL = new InstituteBLL();
                    if (this.ModelId > 0)
                    {
                        DataTable  dt        = instituteBLL.GetById(this.ModelId);
                        Institutes institute = new Institutes();
                        institute.InstituteId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["InstituteId"]));
                        institute.InstituteCode = Convert.ToString(dt.Rows[0]["InstituteCode"]);
                        institute.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                        institute.Logo          = Convert.ToString(dt.Rows[0]["Logo"]);
                        institute.Url           = Convert.ToString(dt.Rows[0]["Url"]);
                        institute.Description   = Convert.ToString(dt.Rows[0]["Description"]);
                        institute.SerialNumber  = Convert.ToInt32(dt.Rows[0]["SerialNumber"]);
                        institute.Attachment    = Convert.ToString(dt.Rows[0]["Attachment"]);
                        institute.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                        institute.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                        institute.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                        institute.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                        institute.CourseId      = Convert.ToInt32(Convert.ToString(dt.Rows[0]["CourseId"]));

                        institute.Name         = name.Trim();
                        institute.Url          = url;
                        institute.SerialNumber = serialNumber;
                        institute.CourseId     = courseId;
                        institute.Logo         = logo;

                        institute.UpdatedDate = DateTime.Now;
                        institute.UpdatedBy   = this.UserInfo;
                        institute.UpdatedFrom = this.StationInfo;

                        if (instituteBLL.Update(institute))
                        {
                            this.MultiEntryDisallow = true;
                            Alert(AlertType.Success, "Updated successfully.");
                            ClearFields();
                        }
                        else
                        {
                            Alert(AlertType.Error, "Failed to update.");
                        }
                    }
                    else
                    {
                        Institutes institute = new Institutes();
                        institute.InstituteCode = this.ModelCode;
                        institute.Name          = name;
                        institute.Logo          = logo;
                        institute.Url           = url;
                        institute.Description   = description;
                        institute.SerialNumber  = serialNumber;
                        institute.Attachment    = string.Empty;
                        institute.CourseId      = courseId;
                        institute.IsActive      = true;
                        institute.CreatedDate   = DateTime.Now;
                        institute.CreatedBy     = this.UserInfo;
                        institute.CreatedFrom   = this.StationInfo;

                        if (instituteBLL.Save(institute))
                        {
                            Alert(AlertType.Success, "Saved successfully.");
                            ClearFields();
                            GenerateCode();
                        }
                        else
                        {
                            Alert(AlertType.Error, "Failed to save.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Alert(AlertType.Error, ex.Message.ToString());
            }
        }
Beispiel #9
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    InstituteBLL instituteBLL = new InstituteBLL();
                    DataTable    dt           = instituteBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string     actionStatus = "Updated";
                            Institutes institute    = new Institutes();
                            institute.InstituteId   = Convert.ToInt32(Convert.ToString(dt.Rows[0]["InstituteId"]));
                            institute.InstituteCode = Convert.ToString(dt.Rows[0]["InstituteCode"]);
                            institute.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                            institute.Logo          = Convert.ToString(dt.Rows[0]["Logo"]);
                            institute.Url           = Convert.ToString(dt.Rows[0]["Url"]);
                            institute.Description   = Convert.ToString(dt.Rows[0]["Description"]);
                            institute.SerialNumber  = Convert.ToInt32(dt.Rows[0]["SerialNumber"]);
                            institute.Attachment    = Convert.ToString(dt.Rows[0]["Attachment"]);
                            institute.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            institute.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            institute.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            institute.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                            institute.CourseId      = Convert.ToInt32(Convert.ToString(dt.Rows[0]["CourseId"]));

                            institute.UpdatedDate = DateTime.Now;
                            institute.UpdatedBy   = UserInfo;
                            institute.UpdatedFrom = StationInfo;

                            if (institute.IsActive)
                            {
                                institute.IsActive = false;
                                actionStatus       = "Deactivated";
                            }
                            else
                            {
                                institute.IsActive = true;
                                actionStatus       = "Activated";
                            }

                            if (instituteBLL.Update(institute))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }