Example #1
0
        public ActionResult ReportLastMonth()
        {
            JsonRepository.JsonMethods rep = new JsonMethods();
            var ldate = DateTime.Now.AddMonths(-1);

            return(View(rep.GetAccountsBetweenDates(ldate, DateTime.Now)));
        }
Example #2
0
        public void Create([FromBody] Account account)
        {
            string      s   = JsonConvert.SerializeObject(account);
            JsonMethods rep = new JsonMethods();

            rep.AddAccount(account);
        }
Example #3
0
        public IEnumerable <Account> GetLastMonthAccounts()
        {
            JsonRepository.JsonMethods rep = new JsonMethods();
            var ldate = DateTime.Now.AddMonths(-1);

            return(rep.GetAccountsBetweenDates(ldate, DateTime.Now));
        }
Example #4
0
        /// <summary>
        /// Gets the instance process by ID.
        /// </summary>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <returns></returns>
        public string GetInstanceProcessByID(string AtulInstanceProcessID)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.GetInstanceProcessByID(Convert.ToInt32(AtulInstanceProcessID));
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #5
0
        /// <summary>
        /// Updates the running process specification.
        /// TODO: MAtch to docs, discuss with Cory
        /// </summary>
        /// <returns></returns>
        public string UpdateRunningProcessSpecification()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.UpdateRunningProcessSpecification();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #6
0
        /// <summary>
        /// Updates the instance process activity.
        /// </summary>
        /// <param name="AtulInstanceProcessActivityID">The atul instance process activity ID.</param>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessActivityID">The atul process activity ID.</param>
        /// <param name="ProcessActivityCompleted">The process activity completed.</param>
        /// <param name="ProcessActivityDidNotApply">The process activity did not apply.</param>
        /// <param name="ProcessActivityDeadlineMissed">The process activity deadline missed.</param>
        /// <param name="InstanceProcessActivityCompletedBy">The instance process activity completed by.</param>
        /// <param name="ModifiedBy">The modified by.</param>
        /// <returns></returns>
        public string UpdateInstanceProcessActivity(int AtulInstanceProcessActivityID, int AtulInstanceProcessID, int AtulProcessActivityID, int ProcessActivityCompleted, int ProcessActivityDidNotApply, int ProcessActivityDeadlineMissed, int InstanceProcessActivityCompletedBy, int ModifiedBy)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.UpdateInstanceProcessActivity(AtulInstanceProcessActivityID, AtulInstanceProcessID, AtulProcessActivityID, ProcessActivityCompleted, ProcessActivityDidNotApply, ProcessActivityDeadlineMissed, InstanceProcessActivityCompletedBy, ModifiedBy);
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #7
0
        /// <summary>
        /// Updates the instance process.
        /// </summary>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessID">The atul process ID.</param>
        /// <param name="ModifiedBy">The modified by.</param>
        /// <param name="OwnedBy">The owned by.</param>
        /// <param name="AtulProcessStatusID">The atul process status ID.</param>
        /// <returns></returns>
        public string UpdateInstanceProcess(int AtulInstanceProcessID, int AtulProcessID, int ModifiedBy, int OwnedBy, int AtulProcessStatusID)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.UpdateInstanceProcess(AtulInstanceProcessID, AtulProcessID, ModifiedBy, OwnedBy, AtulProcessStatusID);
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #8
0
        /// <summary>
        /// Sets the activity prerequsite activity group.
        /// TODO: Request proc to set prereq group Params: ActivityID, GroupID
        /// </summary>
        /// <returns></returns>
        public string SetActivityPrerequsiteActivityGroup()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.SetActivityPrerequsiteActivityGroup();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #9
0
        /// <summary>
        /// Sets the activity man minutes.
        /// TODO: Add man minute column, update proc(s)
        /// </summary>
        /// <returns></returns>
        public string SetActivityManMinutes()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.SetActivityManMinutes();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #10
0
        /// <summary>
        /// Inserts the instance process activity.
        /// </summary>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessActivityID">The atul process activity ID.</param>
        /// <param name="InstanceProcessActivityCompletedBy">The instance process activity completed by.</param>
        /// <param name="CreatedBy">The created by.</param>
        /// <returns></returns>
        public string InsertInstanceProcessActivity(int AtulInstanceProcessID, int AtulProcessActivityID, int InstanceProcessActivityCompletedBy, int CreatedBy)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.InsertInstanceProcessActivity(AtulInstanceProcessID, AtulProcessActivityID, InstanceProcessActivityCompletedBy, CreatedBy);
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #11
0
        /// <summary>
        /// Inserts the instance process.
        /// </summary>
        /// <param name="AtulProcessID">The atul process ID.</param>
        /// <param name="CreatedBy">The created by.</param>
        /// <param name="OwnedBy">The owned by.</param>
        /// <param name="AtulProcessStatusID">The atul process status ID.</param>
        /// <returns></returns>
        public string InsertInstanceProcess(int AtulProcessID, int CreatedBy, int OwnedBy, int AtulProcessStatusID)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.InsertInstanceProcess(AtulProcessID, CreatedBy, OwnedBy, AtulProcessStatusID);
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #12
0
        /// <summary>
        /// Gets all process sub process activity.
        /// TODO: New proc needed to get a subprocess's activities
        /// </summary>
        /// <returns></returns>
        public string GetAllProcessSubProcessActivity()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.GetAllProcessSubProcessActivity();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #13
0
        /// <summary>
        /// Gets all instance process.
        /// </summary>
        /// <returns></returns>
        public string GetAllInstanceProcess()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.GetAllInstanceProcess();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #14
0
        /// <summary>
        /// Enables the activity automation.
        /// TODO: Find/Define appliciable attribute
        /// </summary>
        /// <returns></returns>
        public string EnableActivityAutomation()
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.EnableActivityAutomation();
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #15
0
        /// <summary>
        /// Updates the instance process activity.
        /// </summary>
        /// <param name="AtulInstanceProcessActivityID">The atul instance process activity ID.</param>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessActivityID">The atul process activity ID.</param>
        /// <param name="ProcessActivityCompleted">The process activity completed.</param>
        /// <param name="ProcessActivityDidNotApply">The process activity did not apply.</param>
        /// <param name="ProcessActivityDeadlineMissed">The process activity deadline missed.</param>
        /// <param name="InstanceProcessActivityCompletedBy">The instance process activity completed by.</param>
        /// <param name="ModifiedBy">The modified by.</param>
        /// <returns></returns>
        public string UpdateInstanceProcessActivity(string AtulInstanceProcessActivityID, string AtulInstanceProcessID, string AtulProcessActivityID, string ProcessActivityCompleted, string ProcessActivityDidNotApply, string ProcessActivityDeadlineMissed, string InstanceProcessActivityCompletedBy, string ModifiedBy)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.UpdateInstanceProcessActivity(Convert.ToInt32(AtulInstanceProcessActivityID), Convert.ToInt32(AtulInstanceProcessID), Convert.ToInt32(AtulProcessActivityID), Convert.ToInt32(ProcessActivityCompleted), Convert.ToInt32(ProcessActivityDidNotApply), Convert.ToInt32(ProcessActivityDeadlineMissed), Convert.ToInt32(InstanceProcessActivityCompletedBy), Convert.ToInt32(ModifiedBy));
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #16
0
        /// <summary>
        /// Inserts the instance process activity.
        /// </summary>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessActivityID">The atul process activity ID.</param>
        /// <param name="InstanceProcessActivityCompletedBy">The instance process activity completed by.</param>
        /// <param name="CreatedBy">The created by.</param>
        /// <returns></returns>
        public string InsertInstanceProcessActivity(string AtulInstanceProcessID, string AtulProcessActivityID, string InstanceProcessActivityCompletedBy, string CreatedBy)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.InsertInstanceProcessActivity(Convert.ToInt32(AtulInstanceProcessID), Convert.ToInt32(AtulProcessActivityID), Convert.ToInt32(InstanceProcessActivityCompletedBy), Convert.ToInt32(CreatedBy));
            return(JsonMethods.GetJSONString(returnTable));
        }
Example #17
0
        /// <summary>
        /// Updates the instance process.
        /// </summary>
        /// <param name="AtulInstanceProcessID">The atul instance process ID.</param>
        /// <param name="AtulProcessID">The atul process ID.</param>
        /// <param name="ModifiedBy">The modified by.</param>
        /// <param name="OwnedBy">The owned by.</param>
        /// <param name="AtulProcessStatusID">The atul process status ID.</param>
        /// <returns></returns>
        public string UpdateInstanceProcess(string AtulInstanceProcessID, string AtulProcessID, string ModifiedBy, string OwnedBy, string AtulProcessStatusID)
        {
            DataTable   returnTable = new DataTable();
            Atul_v1Data adb         = new Atul_v1Data();

            returnTable = adb.UpdateInstanceProcess(Convert.ToInt32(AtulInstanceProcessID), Convert.ToInt32(AtulProcessID), Convert.ToInt32(ModifiedBy), Convert.ToInt32(OwnedBy), Convert.ToInt32(AtulProcessStatusID));
            return(JsonMethods.GetJSONString(returnTable));
        }
        private static void Main(string[] args)
        {
            JsonMethods.ExportOrderedAgencies();
            JsonMethods.ExportGuestList();

            XmlMethods.ExportVenuesInSofia();
            XmlMethods.ExportAgenciesByTown();
        }
Example #19
0
        public ActionResult Report(DateTime ldate, DateTime rdate)
        {
            JsonRepository.JsonMethods rep   = new JsonMethods();
            ReportViewModel            model = new ReportViewModel();

            model.Title = "c " + ldate.ToShortDateString() + " по " + rdate.ToShortDateString();
            model.Bills = rep.GetAccountsBetweenDates(ldate, rdate);
            return(View(model));
        }
Example #20
0
        public IEnumerable <Account> GetAccountsBetweenDates(string ldate, string rdate)
        {
            JsonMethods rep = new JsonMethods();
            var         lms = ldate.Split('.');
            var         rms = rdate.Split('.');

            return(rep.GetAccountsBetweenDates(new DateTime(Convert.ToInt32(lms[2]), Convert.ToInt32(lms[1]), Convert.ToInt32(lms[0])),
                                               new DateTime(Convert.ToInt32(rms[2]), Convert.ToInt32(rms[1]), Convert.ToInt32(rms[0]))));
        }
Example #21
0
        private static void Main(string[] args)
        {
            JsonMethods.ImportAgencies();
            JsonMethods.ImportPeople();
            JsonMethods.ImportWeddings();

            XmlMethods.ImportVenues();
            XmlMethods.ImportPresents();
        }
Example #22
0
        public string GetListMediaFile()
        {
            Uri    requestUri = Context.Request.Url;
            string baseUrl    = requestUri.Scheme + Uri.SchemeDelimiter + requestUri.Host + (requestUri.IsDefaultPort ? "" : ":" + requestUri.Port);

            MediaFiles  media_obj = new MediaFiles();
            DataTable   dt        = media_obj.GetListByTypeId(2);
            JsonMethods json_obj  = new JsonMethods();
            string      jsonarray = json_obj.makejsonoftable(dt, makejson.e_without_square_brackets);

            return(jsonarray);
        }
Example #23
0
        static ConfigList GetJsonConfig()
        {
            //ConfigParam[] configParam = null;
            //string heartFlag = null;
            string config_path = @"D:\data\code\vspro\Dll\netMQ\testApp\config.json";

            JsonMethods jsonMethods = new JsonMethods();

            jsonMethods.Encoding = Encoding.UTF8;
            ConfigList configList = jsonMethods.DeserializeObject <ConfigList>(config_path, jsonMethods.Encoding);

            return(configList);
            //configParam = configList.configs;
            //heartFlag = configList.HeartFlag;
            //Console.WriteLine(heartFlag);
            //foreach (ConfigParam con in configParam)
            //{
            //    string identify = con.Identify;
            //    Console.WriteLine(identify);
            //}

            //Console.ReadLine();
        }
Example #24
0
        public void Delete(string id)
        {
            JsonMethods rep = new JsonMethods();

            rep.RemoveAccount(Guid.Parse(id));
        }
Example #25
0
        public void Update([FromBody] Account account)
        {
            JsonMethods rep = new JsonMethods();

            rep.UpdateAccount(account);
        }
Example #26
0
        public Account GetAccount(string id)
        {
            JsonMethods rep = new JsonMethods();

            return(rep.GetAccount(Guid.Parse(id)));
        }
Example #27
0
        public IEnumerable <Account> GetAccounts()
        {
            JsonMethods rep = new JsonMethods();

            return(rep.GetAccounts());
        }
Example #28
0
        public IHttpActionResult Post()
        {
            //取用web.config string
            string MyLineChannelAccessToken = ConfigurationManager.AppSettings["LineChannelAccessToken"];
            var    reqid = isRock.LineBot.Utility.Parsing(Request.Content.ReadAsStringAsync().Result).events[0].replyToken;
            string url   = ConfigurationManager.AppSettings["lineapistorage1128_blob_Jsonfile"];

            try
            {
                //取得 http Post RawData(should be JSON)
                string postData = Request.Content.ReadAsStringAsync().Result;
                //剖析JSON
                var ReceivedMessage = isRock.LineBot.Utility.Parsing(postData);
                //回覆訊息
                string Message = "";
                switch (ReceivedMessage.events[0].message.text)
                {
                case "!指令":
                case "!指令":
                    Message = string.Format("{0}:{1}\n" +
                                            "{2}\n" +
                                            "{3}"
                                            , "!time", "現在時間"
                                            , "!抽、!抽妹子"
                                            , "!抽帥哥"
                                            );
                    break;

                case "!自我介紹":
                case "!self":
                case "!自我介紹":
                case "!self":
                    Message = string.Format("{0}\n{1}", "我只是個只會抽妹子的沒用女僕......"
                                            , "有意見請找willy.chen抱怨");
                    break;

                case "!時間":
                case "!時間":
                case "!time":
                case "!time":
                    Message = string.Format("現在時間:{0}  您說了:{1}", DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"), ReceivedMessage.events[0].message.text);
                    break;

                case "!抽":
                case "!抽":
                case "!抽妹子":
                case "!抽妹子":
                    string[] picURLs = Method.picURLs();
                    if (picURLs.Count() > 0)
                    {
                        Random RandomIndex = new Random();
                        int    Rindex      = RandomIndex.Next(1, picURLs.Count());
                        int    Year        = DateTime.Today.Year;
                        int    Month       = DateTime.Today.Month;
                        int    Day         = DateTime.Today.Day;
                        Rindex = Rindex * Year * Day / Month;
                        Rindex = Rindex % picURLs.Count();
                        //回傳圖片給user
                        isRock.LineBot.Utility.ReplyImageMessage(reqid, picURLs[Rindex], picURLs[Rindex], MyLineChannelAccessToken);
                    }
                    break;

                case "!抽帥哥":
                case "!抽帥哥":
                    Message = "我的把拔只愛妹子  沒帥哥照片可給(攤手";
                    break;

                case "!list":

                    break;

                case "!add":
                case "!add":
                    Members NewMber = new Members();
                    NewMber.Member_Group    = "初號機";
                    NewMber.Member_LineName = "Lusiya";
                    NewMber.Member_GameName = "◆Lusiya◆";

                    //JSON寫入到檔案
                    string json = JsonMethods.DownloadJsonAsync(url);
                    //轉成 Members 類別的物件
                    List <Members> items = JsonConvert.DeserializeObject <List <Members> >(json);
                    items.Add(NewMber);

                    //轉成JSON格式
                    string ConverJson = JsonConvert.SerializeObject(items);

                    //寫入Azuer Json檔案
                    JsonMethods.WriteToAzureBlob(ConverJson, url,
                                                 ConfigurationManager.AppSettings["StorageConnectionString"],
                                                 "memberlist",
                                                 "MemberList.json"
                                                 );
                    //Message = JsonConvert.SerializeObject("成功");
                    Message = "成功";
                    return(Json(Message));

                    break;

                case "!readjson":
                case "!readjson":
                    //從url讀json
                    string         json_read  = JsonMethods.DownloadJsonAsync(url);
                    List <Members> items_read = JsonConvert.DeserializeObject <List <Members> >(json_read);
                    foreach (var item in items_read)
                    {
                        string MemberString = string.Format("Group:{0} LineName:{1} GameName{2}"
                                                            , item.Member_Group, item.Member_LineName, item.Member_GameName);
                        if (Message != "")
                        {
                            Message = string.Format("{0}\n{1}", Message, MemberString);
                        }
                        else
                        {
                            Message = MemberString;
                        }
                    }
                    break;

                case "!id":
                case "!id":
                    Message = ReceivedMessage.events[0].replyToken;
                    break;

                case "!member":
                case "!member":
                    Message = ReceivedMessage.events[0].members.ToString();
                    break;

                case "!msg":
                case "!msg":
                    Message = ReceivedMessage.events[0].message.ToString();
                    break;

                case "!type":
                case "!type":
                    Message = ReceivedMessage.events[0].type.ToString();
                    break;

                case "!pic":
                    //圖片輸出MemoryStream
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    Image_String("中文測試", 20, true, Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 0)).Save(ms, ImageFormat.Png);
                    //Response.ClearContent();
                    //Response.ContentType = "image/png";
                    //Response.BinaryWrite(ms.ToArray());
                    break;

                default:
                    break;
                }

                //回覆用戶
                isRock.LineBot.Utility.ReplyMessage(reqid, Message, MyLineChannelAccessToken);
                //回覆API OK
                return(Ok());
            }
            catch (Exception ex)
            {
                isRock.LineBot.Utility.ReplyMessage(reqid, ex.ToString(), MyLineChannelAccessToken);
                return(Ok());
            }
        }
Example #29
0
        /// <summary>
        /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
        /// </summary>
        /// <param name="request">The HTTP request message to send to the server.</param>
        /// <param name="cancellationToken">A cancellation token to cancel operation.</param>
        /// <returns>
        /// Returns <see cref="T:System.Threading.Tasks.Task`1" />. The task object representing the asynchronous operation.
        /// </returns>
        protected async override Task <HttpResponseMessage> SendAsync(
            HttpRequestMessage request,
            CancellationToken cancellationToken)
        {
            try
            {
                // check if request is encrypted or non encrypted
                var  isNonEncRequest = request.Headers.FirstOrDefault(r => r.Key == "Non-Encrypt-Request");
                bool?isNonEncrypted  = null;
                if (!string.IsNullOrWhiteSpace(isNonEncRequest.Key))
                {
                    isNonEncrypted = true;
                }

                var contentType = request.Content.Headers.ContentType;
                var oldHeaders  = request.Content.Headers;


                if (contentType != null)
                {
                    if (contentType.MediaType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
                    {
                        return(request.CreateResponse(WebMethods.CreateServiceResponseWithErrors("Error")));
                    }

                    if (contentType.MediaType.StartsWith("multipart/form-data", StringComparison.OrdinalIgnoreCase))
                    {
                        if (!request.Content.IsMimeMultipartContent())
                        {
                            return(request.CreateResponse(WebMethods.CreateServiceResponseWithErrors("Error")));
                        }

                        var requestJson = HttpContext.Current.Request.Params["RequestJSON"];
                        if (requestJson != null)
                        {
                            var requestObj     = JsonMethods.JObjectParse(requestJson);
                            var requestContent = requestObj["RequestJSON"];

                            if (requestContent != null)
                            {
                                var jsonData = JsonMethods.CreateJsonRequest(requestContent.ToString(), !isNonEncrypted);
                                request.Content = new StringContent(jsonData);

                                // webapi is not supporting multipart/form-data so request can not redirect to particular action
                                // multipart is possible if action don't have any parameters
                                oldHeaders.Remove("Content-type");
                                oldHeaders.Add("Content-type", "application/json");
                            }
                            else
                            {
                                return(request.CreateResponse(WebMethods.CreateServiceResponseWithErrors("Error")));
                            }
                        }
                        else
                        {
                        }
                    }
                    else if (contentType.MediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase) || contentType.MediaType.StartsWith("text/json", StringComparison.OrdinalIgnoreCase))
                    {
                        var formData       = request.Content.ReadAsStringAsync().Result;
                        var requestObj     = JsonMethods.JObjectParse(formData);
                        var requestContent = requestObj["RequestJSON"];

                        if (requestContent != null)
                        {
                            if (requestContent.ToString() != "{}")
                            {
                                var jsonData = JsonMethods.CreateJsonRequest(requestContent.ToString(), !isNonEncrypted);
                                request.Content = new StringContent(jsonData);
                            }
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        //new Exception(CommonResources.GetError("UnsupportedContentType")).LogToElmah();
                    }
                }

                this.ReplaceHeaders(request.Content.Headers, oldHeaders);
                var response = await base.SendAsync(request, cancellationToken);

                return(response);
            }
            catch (Exception exception)
            {
                var responseMessage = request.CreateResponse(WebMethods.CreateServiceResponseWithErrors("Error"));
                return(responseMessage);
            }
        }
Example #30
0
 public ActionResult Delete(string id)
 {
     JsonRepository.JsonMethods rep = new JsonMethods();
     rep.RemoveAccount(Guid.Parse(id));
     return(RedirectToAction("Index"));
 }