//Background processes
        //process files from Config.xml
        private void MyWorker_DoWork(object Sender, System.ComponentModel.DoWorkEventArgs e)
        {
            DelegateUpdateLabel             Upd_Del_label = new DelegateUpdateLabel(UpdateLabel);
            DelegateUpdateFileList          Upd_file_list = new DelegateUpdateFileList(UpdateFileList);
            DelegateUpdateUpdateProgressBar upd_prog_bar  = new DelegateUpdateUpdateProgressBar(UpdateProgressBar);
            processes proc_config = new processes();

            proc_config.process_config(e.Argument.ToString());
            int file_count = proc_config.proc_files.Count;

            label1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, Upd_Del_label, file_count);
            ProgressBar.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, upd_prog_bar, 0);
            for (int i = 0; i < file_count; i++)
            {
                proc_config.process_file(proc_config.proc_files[i]);
                proc_config.proc_files[i].processed = true;
                double perc = (Convert.ToDouble(i + 1) / Convert.ToDouble(file_count)) * 100;
                lbl_progress.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, Upd_Del_label, file_count - (i + 1));
                ProgressBar.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, upd_prog_bar, perc);


                colSet.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, Upd_file_list, proc_config.proc_files[(i)]);
            }
            e.Cancel = false;
            return;
        }
Example #2
0
        private static void _updateprocesses(ElearnDBDataContext db, int userid, string partcode, int wordid, int?index)
        {
            index = index ?? 0;
            var hasexistid = db.processes.SingleOrDefault(user => user.user_id == userid);

            if (hasexistid == null)
            {
                processes insertone = new processes
                {
                    user_id         = userid,
                    part_code       = partcode,
                    eword_id        = wordid,
                    process_index   = index,
                    oralsentence_id = null
                };
                db.processes.InsertOnSubmit(insertone);
            }
            else
            {
                hasexistid.part_code       = partcode;
                hasexistid.eword_id        = wordid;
                hasexistid.process_index   = index;
                hasexistid.oralsentence_id = null;
            }
            db.SubmitChanges();
        }
Example #3
0
        // GET: api/Occurrence
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        //// GET: api/Occurrence/5
        //public string Get(int id)
        //{
        //    return "value";
        //}

        // POST: api/Occurrence
        public IHttpActionResult Post([FromBody] dynamic value)
        {
            using (testeftEntities db = new testeftEntities())
            {
                occurrences o = new occurrences();

                o.station_id = value.station_id;

                o.occurred_when = value.occurred_when;

                foreach (var proc in value.proc)
                {
                    processes p = new processes();

                    p.name = proc;

                    o.processes.Add(p);
                }

                db.occurrences.Add(o);

                db.SaveChanges();

                return(Ok(o.id));
            }
        }
        /*
         * Andres Alberto Yepes
         * 28-10-2016
         * ***************************************************************************************************************
         * función encargada crear un caso de gestión desembolso.
         *
         * */
        private GestionDesembolsoResponse crearCasoDesembolso(GestionDesembolsoRequest notificacion)
        {
            BizAgiWSParam <M_CAT_GestionDesembolso>     param = new BizAgiWSParam <M_CAT_GestionDesembolso>(Properties.Resources.DominioDomain, Properties.Resources.UsuarioCrearCaso);
            BizAgiWSParamCase <M_CAT_GestionDesembolso> caso  = new BizAgiWSParamCase <M_CAT_GestionDesembolso>(Properties.Resources.ProcesoDesembolso);

            caso.Entities.InfoCaso = new M_CAT_GestionDesembolso();
            caso.Entities.InfoCaso.OidInformacionDesembolso.SNumeroTramite = notificacion.InformacionDesembolso.NumeroTramite;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.SCodigoEstacion               = notificacion.InformacionEstacion.CodigoEstacion;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.SIdentificacionEstacion       = notificacion.InformacionEstacion.IdentificacionEstacion;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.OidTipoDocumentoEstac.SCodigo = notificacion.InformacionEstacion.TipoIdentificacionEstacion.Codigo;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.IRuta              = notificacion.RutaActual;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.IEtapa             = notificacion.EtapaActual;
            caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.DFechaNotificacion = notificacion.FechaNotificacion;
            if (notificacion.InformacionDesembolso.CausalReintegro != null)
            {
                caso.Entities.InfoCaso.OidInformacionDesembolso.OidTrackingDesembolso.OidCausalReintegro.SCodigo = notificacion.InformacionDesembolso.CausalReintegro.Codigo;
            }
            param.Cases[0] = caso;
            BizagiSOALayerOperations <BizAgiWSParam <M_CAT_GestionDesembolso> > ejecutar = new BizagiSOALayerOperations <BizAgiWSParam <M_CAT_GestionDesembolso> >();

            ejecutar.Url = ProxyUtils.GetServiceEndpoint("URLWorkFlowEngine");
            processes crearCasoResp = ejecutar.createCase2(param);

            return(getRespuestaBO(crearCasoResp, EnumSOALayerAction.CreateCase));
        }
Example #5
0
        public void CreateCard()
        {
            var p = new processes(card_mo7sabi.card.process);

            inserttype(card_mo7sabi.part.num_type, card_mo7sabi.cost, Data);

            Data["E8"]  = p.Name;
            Data["E11"] = card_mo7sabi.subject;
            Data["E13"] = "الحصة رقم " + card_mo7sabi.part.num + " : " + card_mo7sabi.part.Name;
            Data["E15"] = " مؤسسة : " + card_mo7sabi.client.Name;
            ///////////////// start top section ////////////
            Data["Z4"] = p.code_.NumProsess[0] + "";
            Data["Y4"] = p.code_.NumProsess[1] + "";
            Data["R4"] = p.code_.Subject + "";
            Data["Q4"] = p.code_.chapter[0] + "";
            Data["P4"] = p.code_.chapter[1] + "";
            Data["O4"] = p.code_.chapter[2] + "";
            Data["N4"] = p.code_.NK[2] + "";
            Data["M4"] = p.code_.NK[0].ToString().ToUpper();
            Data["L4"] = p.code_.NK[1].ToString().ToUpper();

            string year = card_mo7sabi.card.year1.year1.Year.ToString();

            Data["G4"] = year.ElementAt(2) + "";
            Data["F4"] = year.ElementAt(3) + "";
            string a = card_mo7sabi.card.num + "";

            switch (a.Length)
            {
            case 1:
                Data["J4"] = "0";
                Data["I4"] = "0";
                Data["H4"] = a.ElementAt(0) + "";
                break;

            case 2:
                Data["J4"] = "0";
                Data["I4"] = a.ElementAt(0) + "";
                Data["H4"] = a.ElementAt(1) + "";
                break;

            case 3:
                Data["J4"] = a.ElementAt(0) + "";
                Data["I4"] = a.ElementAt(1) + "";
                Data["H4"] = a.ElementAt(2) + "";
                break;
            }
            /////////////////// finsh top section  //////////////

            Data["G32"] = card_mo7sabi.cost + "";
            Data["E36"] = card_mo7sabi.cost + "";
            Data["B36"] = card_mo7sabi.oldCost + "";
            Data["L36"] = (card_mo7sabi.oldCost - card_mo7sabi.cost) + "";

            ExcelHlper excelHlper = new ExcelHlper("mo7asabi_Template", new string[] { "p" });

            excelHlper.EditMenyCell("p", Data);
            excelHlper.SaveAs(card_mo7sabi.card.location);
            excelHlper.Close();
        }
Example #6
0
        public void CreateCard()
        {
            var p = new processes(card_kanoni.card.process);

            inserttype(card_kanoni.part.num_type, card_kanoni.part.Cost, Data);

            Data["F9"]  = p.Name;
            Data["F11"] = " الإلتزام القانوني للمبلغ الملتزم به غير المسدد للعملية الى غاية:" + " 31/ 12/ " + card_kanoni.part.process.date.Year;
            Data["F14"] = "مؤسسة : " + card_kanoni.client.Name;
            ///////////////// start top section ////////////
            Data["Z4"] = p.code_.NumProsess[0] + "";
            Data["Y4"] = p.code_.NumProsess[1] + "";
            Data["R4"] = p.code_.Subject + "";
            Data["Q4"] = p.code_.chapter[0] + "";
            Data["P4"] = p.code_.chapter[1] + "";
            Data["O4"] = p.code_.chapter[2] + "";
            Data["N4"] = p.code_.NK[2] + "";
            Data["M4"] = p.code_.NK[0].ToString().ToUpper();
            Data["L4"] = p.code_.NK[1].ToString().ToUpper();

            string year = card_kanoni.card.year1.year1.Year.ToString();

            Data["G4"] = year.ElementAt(2) + "";
            Data["F4"] = year.ElementAt(3) + "";
            string a = card_kanoni.card.num + "";

            switch (a.Length)
            {
            case 1:
                Data["J4"] = "0";
                Data["I4"] = "0";
                Data["H4"] = a.ElementAt(0) + "";
                break;

            case 2:
                Data["J4"] = "0";
                Data["I4"] = a.ElementAt(0) + "";
                Data["H4"] = a.ElementAt(1) + "";
                break;

            case 3:
                Data["J4"] = a.ElementAt(0) + "";
                Data["I4"] = a.ElementAt(1) + "";
                Data["H4"] = a.ElementAt(2) + "";
                break;
            }
            /////////////////// finsh top section  //////////////

            Data["G32"] = card_kanoni.part.Cost + "";
            Data["E36"] = card_kanoni.part.Cost + "";



            ExcelHlper excelHlper = new ExcelHlper("kanoni_Template", new string[] { "p" });

            excelHlper.EditMenyCell("p", Data);
            excelHlper.SaveAs(card_kanoni.card.location);
            excelHlper.Close();
        }
        public void CreateP1()
        {
            var p = new processes(card_dafa3.part.process);

            inserttype(card_dafa3.part.num_type, card_dafa3.Cost, Data);

            Data["E8"]  = p.Name;
            Data["E11"] = "إلتزام العقد المتعلق ب " + card_dafa3.part.Name;
            if (card_dafa3.part.process.parts.ToList().Count == 1 || card_mo7sabi.part.num_type == 7)
            {
                Data["E13"] = "الحصة رقم " + card_dafa3.part.num + " : " + card_dafa3.part.Name;
            }
            Data["E15"] = " مؤسسة : " + client.Name;
            ///////////////// start top section ////////////
            Data["Z4"] = p.code_.NumProsess[0] + "";
            Data["Y4"] = p.code_.NumProsess[1] + "";
            Data["R4"] = p.code_.Subject + "";
            Data["Q4"] = p.code_.chapter[0] + "";
            Data["P4"] = p.code_.chapter[1] + "";
            Data["O4"] = p.code_.chapter[2] + "";
            Data["N4"] = p.code_.NK[2] + "";
            Data["M4"] = p.code_.NK[0].ToString().ToUpper();
            Data["L4"] = p.code_.NK[1].ToString().ToUpper();

            string year = card_dafa3.part.card_mo7sabi.ToList().FirstOrDefault().card.year1.year1.Year.ToString();

            Data["G4"] = year.ElementAt(2) + "";
            Data["F4"] = year.ElementAt(3) + "";
            string a = card_dafa3.num + "";

            switch (a.Length)
            {
            case 1:
                Data["J4"] = "0";
                Data["I4"] = "0";
                Data["H4"] = a.ElementAt(0) + "";
                break;

            case 2:
                Data["J4"] = "0";
                Data["I4"] = a.ElementAt(0) + "";
                Data["H4"] = a.ElementAt(1) + "";
                break;

            case 3:
                Data["J4"] = a.ElementAt(0) + "";
                Data["I4"] = a.ElementAt(1) + "";
                Data["H4"] = a.ElementAt(2) + "";
                break;
            }
            /////////////////// finsh top section  //////////////

            Data["G32"] = card_dafa3.Cost + "";
            Data["E36"] = card_dafa3.Cost + "";



            excel.EditMenyCell("p", Data);
        }
Example #8
0
        public processes performActivity(string xml)
        {
            WorkflowEngineSOA.WorkflowEngineSOA wfEngine = new WorkflowEngineSOA.WorkflowEngineSOA();
            wfEngine.Url = url;
            string    xmlRespuesta = wfEngine.performActivityAsString(xml);
            processes respuesta    = SerializerManager.DeserializarTo <processes>(xmlRespuesta);

            return(respuesta);
        }
Example #9
0
        public processes createCase2(T param)
        {
            WorkflowEngineSOA.WorkflowEngineSOA wfEngine = new WorkflowEngineSOA.WorkflowEngineSOA();
            wfEngine.Url = url;
            string xml          = SerializerManager.SerializarToXml <T>(param);
            string xmlRespuesta = wfEngine.createCasesAsString(xml);
            //XmlDocument respuesta = new XmlDocument();
            //respuesta.LoadXml(xmlRespuesta);
            processes respuesta = SerializerManager.DeserializarTo <processes>(xmlRespuesta);

            return(respuesta);
        }
        private GestionDesembolsoResponse getRespuestaBO(processes crearCasoResp, EnumSOALayerAction tipoAccion)
        {
            GestionDesembolsoResponse respServicio = new GestionDesembolsoResponse();
            string errorCode = crearCasoResp.process[0].processError.errorCode;

            if (errorCode != null && errorCode.Length > 0)
            {
                respServicio.Codigo = Properties.Resources.ErrorTecnico;
                respServicio.ErrorSistema.Codigo = errorCode;
                if (crearCasoResp.process[0].processError.errorMessage.Entities == null)
                {
                    respServicio.ErrorSistema.Mensaje = crearCasoResp.process[0].processError.errorMessage.Text[0];
                }
                else
                {
                    respServicio.ErrorSistema.Mensaje = crearCasoResp.process[0].processError.errorMessage.Entities.ErrorMessage;
                }
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:
                    respServicio.Mensaje = Properties.Resources.MsgErrorCreandoCaso;
                    break;

                case EnumSOALayerAction.PerformActivity:
                    respServicio.Mensaje = Properties.Resources.MsgErrorPerformActivity;
                    break;
                }
            }
            else
            {
                respServicio.Codigo = Properties.Resources.CodigoExitoBizagi;
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:
                    respServicio.processId = int.Parse(crearCasoResp.process[0].processId);
                    respServicio.Mensaje   = Properties.Resources.MsgExitoCrearCaso;
                    respServicio.radNumber = crearCasoResp.process[0].processRadNumber;
                    break;

                case EnumSOALayerAction.PerformActivity:
                    respServicio.Mensaje = Properties.Resources.MsgExitoPerformaActivity;
                    break;
                }
            }
            return(respServicio);
        }
Example #11
0
        public void CreateP2()
        {
            var p = new processes(card_dafa3.part.process);
            Dictionary <string, string> Data1 = new Dictionary <string, string>();

            Data1["K9"]  = DateTime.Now.Year + "";
            Data1["A19"] = client.Name;
            Data1["A22"] = client.address;
            Data1["E19"] = client.num_account;
            Data1["E21"] = client.bank;
            Data1["E23"] = client.gence;

            Data1["J20"] = p.code_.NK[0].ToString().ToUpper() + p.code_.NK[1].ToString().ToUpper() + p.code_.NK[2].ToString().ToUpper();

            Data1["K20"] = p.code_.chapter[0].ToString() + p.code_.chapter[1].ToString() + p.code_.chapter[2].ToString();

            Data1["M20"] = p.process.date.Year + "";
            Data1["G31"] = card_dafa3.alcost;
            Data1["R19"] = card_dafa3.tswiya;
            excel.EditMenyCell("p2", Data1);
        }
        /*
         * Andres Alberto Yepes
         * 06-01-2017
         * ***************************************************************************************************************
         * función encargada de realizar el perform activity. como base utiliza xslt para realizar la transformación de la información
         * recibida en la fachada a la estructura esperada por Bizagi de acuerdo al modelo de datos del proceso. No tiene acoplamiento
         * con la estructura del proceso, mas allá que a través de la xslt recibida anteriormente. Utiliza una clase generica para realizar
         * el perform activity funcionando como un DTO.
         *
         * */
        private GestionDesembolsoResponse performActivity2(GestionDesembolsoRequest notificacion, InfoCasoDesembolso casoDesembolsoConsultado)
        {
            XmlDocument request = SerializerManager.SerializarToXmlDocument <GestionDesembolsoRequest>(notificacion);

            HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParam             param    = new HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParam();
            HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParamActivityData activity = new HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParamActivityData();

            activity.idCase   = casoDesembolsoConsultado.OidTrackingDesembolso.IIdCaso;
            activity.taskName = casoDesembolsoConsultado.OidTrackingDesembolso.OidActividadEspera.STaskName;
            param.domain      = Properties.Resources.DominioFNA;
            param.userName    = casoDesembolsoConsultado.OidTrackingDesembolso.SNombreUsuarioEstacion;

            param.ActivityData = activity;
            BizagiSOALayerOperations <HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParam> ejecutar = new BizagiSOALayerOperations <HUB.BizagiSOAObjects.PeformActivityGeneric.BizAgiWSParam>();

            ejecutar.Url = ProxyUtils.GetServiceEndpoint("URLWorkFlowEngine");
            string      xmlParam    = SerializerManager.SerializarToXml(param);
            XmlDocument paramDocXML = new XmlDocument();

            paramDocXML.LoadXml(xmlParam);
            XPathNavigator navigatorParam = paramDocXML.CreateNavigator();

            //transforma el request en un xml con la definición de esquema del proceso en Bizagi
            string      xmlEntities    = XMLOperations.XSLTransformation(casoDesembolsoConsultado.OidTrackingDesembolso.OidActividadEspera.STransformacion, request);
            XmlDocument docEntitiesXml = new XmlDocument();

            docEntitiesXml.LoadXml(xmlEntities);
            XPathNavigator navEntities = docEntitiesXml.CreateNavigator();

            //crea el nodo de entities
            navigatorParam.MoveToChild("BizAgiWSParam", String.Empty);
            navigatorParam.AppendChild("<Entities></Entities>");
            navigatorParam.MoveToChild("Entities", String.Empty);
            //inserta en el nodo entities el xml con el xml transformado por la xslt
            navigatorParam.AppendChild(docEntitiesXml.OuterXml);

            processes performResp = ejecutar.performActivity(paramDocXML.OuterXml);

            return(getRespuestaBO(performResp, EnumSOALayerAction.PerformActivity));
        }
        public AddCardMo7asabi(processes processes, Action _save, Action con)

        {
            nowCost = processes.process.NewCost;
            list    = new List <CommboxItem>();

            foreach (part part in processes.process.parts.ToList())
            {
                item.Add(new ItemPart(part));
            }

            //    save =new  Command(async ()=> {
//                    _save();

            /*      await Task.Run(() => {
             *         var card=  new Card_mo7sabi(null);
             *
             *        card.CreateCard();
             *   });
             * //              con();
             */
            //  });
        }
Example #14
0
 public static ewords GetNextWord(int userid, processes process)
 {
     using (var db = new ElearnDBDataContext())
     {
         ewords nextword = null;
         if (_haveprocess(db, userid))
         {
             nextword = _getnextword(db, process.part_code, process.eword_id);
             if (nextword == null)
             {
                 return(null);
             }
             else
             {
                 _updateprocesses(db, userid, process.part_code, nextword.eword_id, process.process_index + 1);
                 return(nextword);
             }
         }
         else
         {
             return(null);
         }
     }
 }
Example #15
0
        public void CreateCard()
        {
            var p = new processes(card_sa7ab.card.process);

            types types = new types();

            foreach (p_sa7ab pr in card_sa7ab.p_sa7ab)
            {
                types.insert(pr.part.num_type, pr.cost);
            }

            types.leadData(Data);
            Data["F9"]  = p.Name;
            Data["F11"] = " سحب المبلغ الملتزم به غير المسدد للعملية الى غاية: 31/ 12/ " + p.process.cards.ToList().LastOrDefault().year1.year1.Year;
            //       Data["F11"] = "أخذ بالحساب رقم للمقرر رقم "+p.process.num+" المؤرخ بتاريخ "+p.process.date.ToShortDateString();
            ///////////////// start top section ////////////
            Data["Z4"] = p.code_.NumProsess[0] + "";
            Data["Y4"] = p.code_.NumProsess[1] + "";
            Data["R4"] = p.code_.Subject + "";
            Data["Q4"] = p.code_.chapter[0] + "";
            Data["P4"] = p.code_.chapter[1] + "";
            Data["O4"] = p.code_.chapter[2] + "";
            Data["N4"] = p.code_.NK[2] + "";
            Data["M4"] = p.code_.NK[0].ToString().ToUpper();
            Data["L4"] = p.code_.NK[1].ToString().ToUpper();

            string year = card_sa7ab.card.year1.year1.Year.ToString();

            Data["G4"] = year.ElementAt(2) + "";
            Data["F4"] = year.ElementAt(3) + "";
            string a = card_sa7ab.card.num + "";

            switch (a.Length)
            {
            case 1:
                Data["J4"] = "0";
                Data["I4"] = "0";
                Data["H4"] = a.ElementAt(0) + "";
                break;

            case 2:
                Data["J4"] = "0";
                Data["I4"] = a.ElementAt(0) + "";
                Data["H4"] = a.ElementAt(1) + "";
                break;

            case 3:
                Data["J4"] = a.ElementAt(0) + "";
                Data["I4"] = a.ElementAt(1) + "";
                Data["H4"] = a.ElementAt(2) + "";
                break;
            }
            /////////////////// finsh top section  //////////////

            Data["G32"] = card_sa7ab.card + "";
            Data["E36"] = card_sa7ab.card + "";

            Data["B36"] = card_sa7ab.old_cost + "";
            Data["L36"] = (card_sa7ab.old_cost + card_sa7ab.cost) + "";



            ExcelHlper excelHlper = new ExcelHlper("sa7ab_Template", new string[] { "p" });

            excelHlper.EditMenyCell("p", Data);
            excelHlper.SaveAs(card_sa7ab.card.location);
            excelHlper.Close();
        }
        public GanttChart GetDailyProduction(string cdate, int lineid) //date format : dd/MM/yyyy
        {
            DateTime startdate = Convert.ToDateTime(cdate);
            DateTime enddate   = Convert.ToDateTime(cdate).AddDays(1);



            IList <OrderDetail> orderdetail = db.OrderDetails
                                              //.Include(o => o.Line)
                                              .Include(o => o.Product)
                                              //.Include(o => o.Shift)
                                              .Where(o => o.CreatedDate.Year == startdate.Year && o.CreatedDate.Month == startdate.Month && o.CreatedDate.Day == startdate.Day && o.LineId == lineid && o.FinalStatus == 1)
                                              .OrderBy(x => x.OrderId).ToList();


            var count = orderdetail.Count;

            GanttChart objganttchart = new GanttChart();

            objganttchart.type       = "gantt";
            objganttchart.width      = "100%";
            objganttchart.height     = "120";
            objganttchart.dataFormat = "json";

            dataSource objdatasource = new dataSource();


            //chart

            chart objchart = new chart();

            objchart.theme          = "fusion";
            objchart.dateformat     = "dd/mm/yyyy hh:mn";
            objchart.showTaskLabels = 1;


            //task

            gtask[] arrtask = new gtask[count];


            for (int i = 0; i < count; i++)
            {
                var objtask = new gtask();

                objtask.label     = orderdetail[i].Product.ProductDesc;
                objtask.processid = "A";
                objtask.start     = orderdetail[i].OrderStartTime.ToString("dd/MM/yyyy HH:mm");

                DateTime endtime = orderdetail[i].OrderEndTime ?? DateTime.Now;
                objtask.end = endtime.ToString("dd/MM/yyyy HH:mm");

                objtask.color = "#" + orderdetail[i].Product.ProductColor;
                objtask.alpha = "85";

                arrtask[i] = objtask;
            }

            gtasks objtasks = new gtasks();

            objtasks.task = arrtask;


            //processes

            processes objprocesses = new processes();

            process[] arrprocess = new process[1];

            process objprocess = new process();

            objprocess.label = orderdetail[0].OrderStartTime.ToString("dd/MM/yyyy");
            objprocess.id    = "A";

            arrprocess[0] = objprocess;

            objprocesses.isbold  = "1";
            objprocesses.process = arrprocess;


            //categories

            categories[] arrcategories = new categories[1];

            categories objcategories = new categories();

            objcategories.bgalpha = "0";

            //category1

            category[] arrcategory1 = new category[1];

            category objcategory1 = new category();

            objcategory1.start = startdate.ToString("dd/MM/yyyy 06:00");
            objcategory1.end   = enddate.ToString("dd/MM/yyyy 06:00");
            objcategory1.label = "";

            arrcategory1[0]         = objcategory1;
            objcategories.category1 = arrcategory1;

            //category

            category[] arrcategory = new category[24];

            int arrcategorycount = arrcategory.Length;

            for (int i = 0; i < arrcategorycount; i++)
            {
                int k = i + 1;

                int stime = 6 + i;
                int etime = 6 + k;


                int starttime = stime >= 24 ? stime - 24 : stime;
                int endtime   = etime >= 24 ? etime - 24 : etime;

                string startimeformat = starttime.ToString().Length == 1 ? "0" + starttime.ToString() + ":00" : starttime.ToString() + ":00";
                string endtimeformat  = endtime.ToString().Length == 1 ? "0" + endtime.ToString() + ":00" : endtime.ToString() + ":00";

                category objcategory = new category();
                objcategory.start = stime >= 24 ? enddate.ToString("dd/MM/yyyy " + startimeformat + "") : startdate.ToString("dd/MM/yyyy " + startimeformat + "");
                objcategory.end   = stime >= 23 ? enddate.ToString("dd/MM/yyyy " + endtimeformat + "") : startdate.ToString("dd/MM/yyyy " + endtimeformat + "");
                objcategory.label = startimeformat;

                arrcategory[i] = objcategory;
            }


            objcategories.category = arrcategory;


            arrcategories[0] = objcategories;

            objdatasource.chart      = objchart;
            objdatasource.tasks      = objtasks;
            objdatasource.processes  = objprocesses;
            objdatasource.categories = arrcategories;

            objganttchart.dataSource = objdatasource;


            return(objganttchart);
        }
Example #17
0
        public void CreateCard()
        {
            var p = new processes(card_7isab.card.process);

            types  types   = new types();
            double Allcost = 0;

            foreach (part pr in p.process.parts.ToList())
            {
                types.insert(pr.num_type, pr.Cost);
                Allcost += pr.Cost;
            }

            types.leadData(Data);
            Data["F9"]  = p.Name;
            Data["F11"] = "أخذ بالحساب رقم للمقرر رقم " + p.process.num + " المؤرخ بتاريخ " + p.process.date.ToShortDateString();
            ///////////////// start top section ////////////
            Data["Z4"] = p.code_.NumProsess[0] + "";
            Data["Y4"] = p.code_.NumProsess[1] + "";
            Data["R4"] = p.code_.Subject + "";
            Data["Q4"] = p.code_.chapter[0] + "";
            Data["P4"] = p.code_.chapter[1] + "";
            Data["O4"] = p.code_.chapter[2] + "";
            Data["N4"] = p.code_.NK[2] + "";
            Data["M4"] = p.code_.NK[0].ToString().ToUpper();
            Data["L4"] = p.code_.NK[1].ToString().ToUpper();

            string year = card_7isab.card.year1.year1.Year.ToString();

            Data["G4"] = year.ElementAt(2) + "";
            Data["F4"] = year.ElementAt(3) + "";
            string a = card_7isab.card.num + "";

            switch (a.Length)
            {
            case 1:
                Data["J4"] = "0";
                Data["I4"] = "0";
                Data["H4"] = a.ElementAt(0) + "";
                break;

            case 2:
                Data["J4"] = "0";
                Data["I4"] = a.ElementAt(0) + "";
                Data["H4"] = a.ElementAt(1) + "";
                break;

            case 3:
                Data["J4"] = a.ElementAt(0) + "";
                Data["I4"] = a.ElementAt(1) + "";
                Data["H4"] = a.ElementAt(2) + "";
                break;
            }
            /////////////////// finsh top section  //////////////

            Data["G32"] = Allcost + "";
            Data["E36"] = Allcost + "";
            Data["L36"] = Allcost + "";



            ExcelHlper excelHlper = new ExcelHlper("7isab_Template", new string[] { "p" });

            excelHlper.EditMenyCell("p", Data);
            excelHlper.SaveAs(card_7isab.card.location);
            excelHlper.Close();
        }