コード例 #1
0
        public ActionResult EquipmentUserActivity(int id, string Puser, string statusvalue)
        {
            equipmetAcceptUser PEquipmentAccreptUser = new equipmetAcceptUser();

            PEquipmentAccreptUser.equipmentId    = id;
            PEquipmentAccreptUser.userName       = Puser;
            PEquipmentAccreptUser.statusSelected = statusvalue;
            PEquipmentAccreptUser.registerDate   = ExtensionFunction.ToPersian(DateTime.Now);
            Context.equipmetAcceptUsers.Add(PEquipmentAccreptUser);
            Context.SaveChanges();

            return(RedirectToAction("listEquipments"));
        }
コード例 #2
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            // creating Excel Application
            Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
            // creating new WorkBook within Excel application
            Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
            // creating new Excelsheet in workbook
            Microsoft.Office.Interop.Excel._Worksheet worksheet = null;

            // get the reference of first sheet. By default its name is Sheet1.
            // store its reference to worksheet
            worksheet = workbook.Sheets["Sheet1"];
            worksheet = workbook.ActiveSheet;

            // changing the name of active sheet
            //worksheet.Name = "Exported from gridview";
            worksheet.DisplayRightToLeft = true;
            DialogResult res = FMessegeBox.FarsiMessegeBox.Show("نسبت به گرفتن خروجی اکسل اطمینان دارید؟", "پرسش", FMessegeBox.FMessegeBoxButtons.YesNo, FMessegeBox.FMessegeBoxIcons.Question, FMessegeBox.FMessegeBoxDefaultButton.button1);

            if (res != DialogResult.Yes)
            {
                app.Quit();
                return;
            }
            for (int i = 1; i < membersView.Columns.Count + 1; i++)
            {
                worksheet.Cells[1, i] = membersView.Columns[i - 1].HeaderText;
            }
            // storing Each row and column value to excel sheet
            for (int i = 0; i < membersView.Rows.Count; i++)
            {
                for (int j = 0; j < membersView.Columns.Count; j++)
                {
                    if (membersView.Rows[i].Cells[j].Value.GetType().ToString() == "System.DateTime")
                    {
                        worksheet.Cells[i + 2, j + 1] = ExtensionFunction.ToPersian(Convert.ToDateTime(membersView.Rows[i].Cells[j].Value.ToString()));
                    }
                    else
                    {
                        worksheet.Cells[i + 2, j + 1] = membersView.Rows[i].Cells[j].Value.ToString();
                    }
                }
            }
            // see the excel sheet behind the program
            app.Visible = true;
            // save the application
            //workbook.SaveAs("c:\\output.xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            // Exit from the application
            //app.Quit();
        }
コード例 #3
0
        public ActionResult JobUserActivity(int id, string Puser, string statusvalue)
        {
            jobAcceptUser PJobAccreptUser = new jobAcceptUser();

            PJobAccreptUser.jobId          = id;
            PJobAccreptUser.userName       = Puser;
            PJobAccreptUser.statusSelected = statusvalue;
            PJobAccreptUser.registerDate   = ExtensionFunction.ToPersian(DateTime.Now);
            Context.jobAcceptUsers.Add(PJobAccreptUser);
            Context.SaveChanges();



            return(RedirectToAction("listJobs"));
        }
コード例 #4
0
        public ActionResult UserActivity(int id, string Puser, string statusvalue)
        {
            melkAcceptUser PmelkAccreptUser = new melkAcceptUser();

            PmelkAccreptUser.melkId         = id;
            PmelkAccreptUser.userName       = Puser;
            PmelkAccreptUser.statusSelected = statusvalue;
            PmelkAccreptUser.RegisterDate   = ExtensionFunction.ToPersian(DateTime.Now);
            Context.melkAcceptUsers.Add(PmelkAccreptUser);
            Context.SaveChanges();



            return(RedirectToAction("GetMelkInfo"));
        }